Hi, I need help with AVR Assembler language I need to do a traffic light project, with a RIP sensor and 3 LEDs. I guess I have to set the sensor like there is no motion detected at first and the red led on, then when motion detected, turn the yellow led on for some time and then the green. Problem is that it has to be in assembler language and I don't know how to start. This is how I built the Arduino system(also not sure if it's good):

1) Define input and output pin first.
2) Define analog pin as sensor input.
3) Define digital pin as output to blink led
4) UNDER VOID LOOP put all condition and its respective output.
For sample programing of arduino see below code for "simple line follower robot " and use the same structure and code to implement in your project just by doing some modification as per your project.
example-
/*-------definning Inputs------*/
#define LS 2 // left sensor
#define RS 5 // right sensor
/*-------definning Outputs------*/
#define LM1 11 // left motor
#define LM2 10 // left motor
#define RM1 9 // right motor
#define RM2 6 // right motor
void setup()
{
pinMode(LS, INPUT);
pinMode(RS, INPUT);
pinMode(LM1, OUTPUT);
pinMode(LM2, OUTPUT);
pinMode(RM1, OUTPUT);
pinMode(RM2, OUTPUT);
}
void loop(){
if((digitalRead(LS)==LOW) && (digitalRead(RS)==LOW)) // Condition_1 stop
{
MoveForward();
}
if((digitalRead(LS)==HIGH) && (digitalRead(RS)==HIGH)) //CONDITION-2 FORWRD
{
Stop();
}
if((digitalRead(LS)==LOW) && (digitalRead(RS)==HIGH)) // RIGHT
{
TurnLeft();
}
if((digitalRead(LS)==HIGH) && (digitalRead(RS)==LOW))
{
TurnRight();
}
}
void MoveForward()
{
analogWrite(LM1, 50);
analogWrite(LM2, 0);
analogWrite(RM1, 50);
analogWrite(RM2, 0);
delay(20);
}
void TurnRight()
{
analogWrite(LM1, 0);
analogWrite(LM2, 60);
analogWrite(RM1, 60);
analogWrite(RM2, 0);
delay(30);
}
void TurnLeft()
{
analogWrite(LM1, 60);
analogWrite(LM2, 0);
analogWrite(RM1, 0);
analogWrite(RM2, 60);
delay(30);
}
void Stop()
{
analogWrite(LM1, 0);
analogWrite(LM2, 0);
analogWrite(RM1, 0);
analogWrite(RM2, 0);
delay(20);
}
Hi, I need help with AVR Assembler language I need to do a traffic light project, with a RIP sens...
I am doing an Arduino Uno project where I made a "Simon says" memory game with 3 neopixel LED strips and 3 - ultrasonics. I have them working independently but I need to combine the code so they work together. Here is what I have: Memory Game #define PLAYER_WAIT_TIME 2000 // The time allowed between button presses - 2s byte sequence[100]; // Storage for the light sequence byte curLen = 0; // Current length of the sequence byte inputCount =...