Hi, I'm new to Arduino, and I'm trying to write a program that acts like a monostable circuit. I've written the following code that was supposed to run a motor off pin 5 if pin 8 has power applied to it. so far it is not working - I do not appear to be getting power at pin 5. any thoughts about what I'm doing wrong?
int motorPin = 5;
int switchIn = 8;
int val = 0;
void setup()
{
pinMode(motorPin, OUTPUT);
pinMode(switchIn, INPUT);
}
void loop()
{
val = digitalRead(switchIn);
if (val == HIGH)
{
digitalWrite(motorPin, HIGH);
}
}