my first self written code for the arduino no error warnings but it dont work either.
help from those who know is much appreciated thank you.
my goals are:
1 to get led pin 13 to lite up and shut off when a push button is being pressed or not pressed.
2 after i get that working to write that on/off value to make the lite toggle every time i press the button.
this is my attempt to under stand how to code for sensors to achieve a programmed response. i would like to use ir receivers this is a 1ST step to that goal.
here my code:
int analogPin = 0;
int val = 0;
int ledPin = 13;
void setup()
{ pinMode(ledPin, OUTPUT);
pinMode(analogPin, INPUT);
}
void loop()
{
val = analogRead(analogPin);
switch (val){
case 1:
val == 0;
digitalWrite(ledPin,LOW);
case 2:
val == 1;
digitalWrite(ledPin,HIGH);
}
} :-?