Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup ()
- {
- pinMode(0,OUTPUT); //IB1
- pinMode(1,OUTPUT); //IA1
- //// pinMode(2,OUTPUT); //IB2
- //// pinMode(3,OUTPUT); //IA2
- // pinMode(4,OUTPUT); //RGB
- // pinMode(5,OUTPUT); //RGB
- // pinMode(6,OUTPUT); //RGB
- // pinMode(A0,INPUT); //lMotor
- //// pinMode(A1,INPUT); //rMotor
- // Serial.begin(9600);
- }
- void loop ()
- {
- digitalWrite(0,HIGH);
- delay(1000);
- digitalWrite(0,LOW);
- delay(1000);
- // int lMotor = analogRead(A0);
- // Serial.write(lMotor);
- //// int lMotor = analogRead(A1);
- //// Serial.write(lMotor);
- //
- // if (lMotor>10)
- // {
- // digitalWrite(4,HIGH);
- // digitalWrite(5,HIGH);
- // digitalWrite(6,LOW);
- // }
- // else
- // {
- // digitalWrite(4,HIGH);
- // digitalWrite(5,LOW);
- // digitalWrite(6,HIGH);
- // }
- }
- void setup ()
- {
- pinMode(0,OUTPUT);
- pinMode(1,OUTPUT);
- }
- void loop ()
- {
- digitalWrite(0,HIGH);
- delay(1000);
- digitalWrite(0,LOW);
- delay(1000);
- }
- void setup ()
- {
- pinMode(0,OUTPUT); //IB1
- pinMode(1,OUTPUT); //IA1
- // pinMode(2,OUTPUT); //IB2
- // pinMode(3,OUTPUT); //IA2
- pinMode(4,OUTPUT); //RGB red
- pinMode(5,OUTPUT); //RGB green
- pinMode(6,OUTPUT); //RGB blue
- boolean motorOn = false;
- }
- void loop ()
- {
- digitalWrite(0,motorOn);
- if(motorOn) {
- digitalWrite(4,HIGH); // red on
- digitalWrite(5,LOW); // green off
- digitalWrite(6,LOW); // blue off
- }
- digitalWrite(4,LOW); // red off
- digitalWrite(5,HIGH); // green on
- digitalWrite(6,LOW); // blue off
- }
- delay(1000); // wait
- motorOn = !motorOn; // toggle the status of the motor.
- }
- void setup ()
- {
- pinMode(0,OUTPUT); //IB1
- pinMode(1,OUTPUT); //IA1
- // pinMode(2,OUTPUT); //IB2
- // pinMode(3,OUTPUT); //IA2
- pinMode(4,OUTPUT); //RGB red
- pinMode(5,OUTPUT); //RGB green
- pinMode(6,OUTPUT); //RGB blue
- boolean motorOn = false;
- }
- void loop ()
- {
- motorOn = false;
- digitalWrite(0,motorOn);
- updateLEDs(); // update the LED status
- delay(1000); // wait
- motorOn = true; // toggle the status of the motor.
- digitalWrite(0,motorOn);
- updateLEDs(); // update the LED status
- delay(750); // wait a different time
- }
- void updateLEDs(){
- // This routine updates the LEDs based on status of motorOn.
- if(motorOn) {
- digitalWrite(4,HIGH); // red on
- digitalWrite(5,LOW); // green off
- digitalWrite(6,LOW); // blue off
- }
- digitalWrite(4,LOW); // red off
- digitalWrite(5,HIGH); // green on
- digitalWrite(6,LOW); // blue off
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement