Hello everyone! I was looking at a blog post recently for my first arduino project and I wanted to try the same thing the original poster did, which is basically turn a lamp on and off with my voice (blog post: http://jacksondolan.com/blag/2013/10/16/bringing-jarvis-home/). I have the same code as him, and I'm using the same pins as him. However, the red light on the powertail switch does not light up, for whatever reason.
The light only turns on when I connect "-in" to ground instead of A0. This makes sense, since ground only outputs 0. However, the light does not turn on when I connect it to the predefined negative pin.
Is it the pins? Is it the tail? Or am I doing something stupid? Why doesn't the blog poster have anything connected to pin 13?
I'll post the void action() code and a picture of my connections. Let me know if you want to see the whole thing.
(Sorry if I posted in the wrong spot. I'm new here and this seemed mostly a hardware issue.)
Thanks.
The code (powerPin is A0 on the board):
void action()
{
switch (group)
{
case GROUP_0:
switch (idx)
{
case G0_ARDUINO:
group=GROUP_1;
// write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
}
break;
case GROUP_1:
switch (idx)
{
case G1_LIGHT:
Serial.println("In Light");
powerOn=!powerOn;
if(powerOn) {
Serial.println("Power On");
digitalWrite(powerPin, LOW);
digitalWrite(13, HIGH);
}else{
Serial.println("Power Off");
digitalWrite(powerPin, HIGH);
digitalWrite(13, LOW);
}
// write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
case G1_THANK_YOU:
group=GROUP_0;
// write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
}
break;
}
}