2 comments for “More GPIO basics from RasPi.TV – inputs and outputs on the #RaspberryPi

  1. Hi,
    My name is John and im a very old Technical Trainer in Melbourne Australia. I work for Metro Trains Melbourne.
    I am really new to this but have a project that relates to work that uses a RPi (3) to represent a model of a train control system. it’s simple logic really but having trouble understanding how I can input four track conditions. When the track is occupied it creates a input voltage. So say; a and b are tracks, the program has to compare the states of a and b like this:

    if a =1 and b = 1 then ‘vr’= 1; (internal control bit)
    if vr = 1 then hr= 1;(internal control bit)
    else hr = 0;
    dr is a internal bit too however it is dependant on the output values of other signals
    (so if track a or b is occupied the signal goes to red)
    One signal is controlled like so:
    if hr = 1 and dr = 1 then;
    output LED1 (green)
    if hr = 1 and dr =0 then;
    output LED 2 (yellow)
    if hr = 0 then;
    output LED 3 (red)

    The condition of the vr (1 or 0) should also be an out if there’s enough outputs. however could rely on state of hr.

    could you help me with this problem?
    regards

    john

    ;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.