Академический Документы
Профессиональный Документы
Культура Документы
h>
IRrecv irrecv(IRsensorPin);
decode_results results;
void setup(){
pinMode(LeftMotorForward,OUTPUT);
pinMode(RightMotorForward,OUTPUT);
pinMode(LeftMotorBackward,OUTPUT);
pinMode(RightMotorBackward,OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn();
void loop(){
/* if the sensor is receive any signal */
if (irrecv.decode(&results)){
Serial.println(results.value);
delay(5);
irrecv.resume();
/* if the incoming data is "defined hex code" then run the motors functions */
/* instead of zeros "0000", write the hex codes of your remote control */
/* FORWARD */
void MotorForward(){
digitalWrite(LeftMotorForward,HIGH);
digitalWrite(RightMotorForward,HIGH);
digitalWrite(LeftMotorBackward,LOW);
digitalWrite(RightMotorBackward,LOW);
/* BACKWARD */
void MotorBackward(){
digitalWrite(LeftMotorBackward,HIGH);
digitalWrite(RightMotorBackward,HIGH);
digitalWrite(LeftMotorForward,LOW);
digitalWrite(RightMotorForward,LOW);
/* TURN RIGHT */
void TurnRight(){
digitalWrite(LeftMotorForward,HIGH);
digitalWrite(RightMotorForward,LOW);
digitalWrite(LeftMotorBackward,LOW);
digitalWrite(RightMotorBackward,HIGH);
/* TURN LEFT */
void TurnLeft(){
digitalWrite(RightMotorForward,HIGH);
digitalWrite(LeftMotorForward,LOW);
digitalWrite(LeftMotorBackward,HIGH);
digitalWrite(RightMotorBackward,LOW);
/* STOP */
void MotorStop(){
digitalWrite(LeftMotorBackward,LOW);
digitalWrite(RightMotorBackward,LOW);
digitalWrite(LeftMotorForward,LOW);
digitalWrite(RightMotorForward,LOW);
Light follower
void setup ()
pinMode (buzzer, OUTPUT) ;// set the digital IO pin mode, OUTPUT out of Wen
void loop ()
{
while (1)
Light foll