Close

movement sensor

A project log for Sky rider game controller

Interactive game controller for the Sky riders online game

angleAngèle 12/12/2023 at 16:270 Comments

Today we worked on the movement sensor in ordre to turn right and left. We used the following code:

void setup() {
  pinMode(7,INPUT);
  Serial.begin(9600);
  int a=0;
}
void loop() {
  int a=0;
  Serial.print("IRSensorip  ");
  Serial.println(digitalRead(7));
  if(digitalRead(7)==0){
   a=0;
   Serial.println(a);
   delay(10);
  }
  else{
    a=1;
    Serial.println(a);
    delay(10);
  }

Discussions