Skip to content

faberc/Intersection_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Intersection_Project

Welcome! When working on this project, please refer to the Programming Timing diagram for notes about how the program should run, as well as the circuit diagram for the pinouts from the LabJack.

Please use the support functions such as analogWrite, digitalRead, etc. rather than the hardcode for LabJack reading and writing for ease of use. Please also continuously add documentation to your code so we don't have to do it later.

NOTE: Even if something is checked off, please review the code to see that it looks okay to you and to get a feel for what it does. Certain scripts will be dependent on other scripts, and double and triple checking is always better than never checking! 👍

Other Helpful Links:

Support Functions

  • digitalWrite() % Write digital state
  • digitalRead() % Read digital state
  • analogWrite() % Output analog voltage
  • analogRead() % Read analog voltage
  • shiftOut() % Shift out traffic light signals
  • initializeLJ() % Initialize LabJack (configure analog-read pins)
  • diagnostic() % Function allowing us to test particular aspects of the board and produces command window outputs. Maybe make a GUI.
  • gtreset() % Global timer start and reset
  • gtime() % Outputs the global time multiplied by a defined speed.

Functions

  • trafficLights() % Controls traffic light timing; has speed input
    • turnLane() % Reads Hall-Effect Sensors and outputs states at certain times.
  • crossWalkLights() % Controls crosswalk indicator timing.
    • crossWalkButtons() % Continuously reads from crosswalk buttons.
  • ambientLight() % Reads ambient light, and turns on street lamps at particular threshold.
  • driver() % Call all other functions.

Variables

  • t = gtime() % the general expression for time in time-based functions.
  • night % state that says if ambient light is dark or not
  • buttonsEW
  • buttonsNS

Global Variables

  • ljHandle % The specific LabJack call handle
  • LJ_ioGET_AIN
  • LJ_ioPUT_DAC
  • LJ_ioPUT_DIGITAL_BIT
  • LJ_ioGET_DIGITAL_BIT
  • gtimer % A 'tic' timer. Call with toc(gtimer).
  • TLAseq % flag telling whether to follow turn lane sequence
  • TLCseq
  • readyEW % flag telling whether crosswalk button was pressed.
  • readyNS
  • speed % defines the speed of the pattern. Multiply to gtimer toc time to increase speed.

Constants

  • Pin Assignment Constants % see circuit diagram
  • LowerLightThreshold % related to ambientLight() function. Thresholds for bright or dark ambient light.
  • UpperLightThreshold

Inputs

  • Hall Effect Sensor 1 & Hall Effect Senseor 2
  • Photoresistor Voltage
  • Buttons 1-6-4-5
  • Buttons 2-3

About

LabJack Code for Intersection Project [ECE-102]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •