Pages: 1 [2]   Go Down
Author Topic: Button triggered Macro, problems with interrupt and delay  (Read 1101 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is what I'm getting output to the serial monitor... which is exactly what I'd expect:
Quote
seq 0: 10000000000000000000001111101000
seq 1: 1000000000000000000001111101000
seq 2: 100000000000000000001111101000
seq 3: 10000000000000000001111101000
seq 4: 1000000000000000001111101000
seq 5: 100000000000000001111101000
seq 6: 10000000000000001111101000
seq 7: 1000000000000001111101000
seq 8: 100000000000001111101000
seq 9: 10000000000001111101000
seq 10: 1000000000001111101000
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49080
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
int pin_B = 0;
int pin_X = 1;
These are the serial pins, you know. If you are doing Serial I/O (and you are), you can't expect to use them with LEDs, too.

Quote
when I run my new function instead, which loops through an array and should be doing the exact same thing as "doStuff" the pin for pin_B, and pin_X don't work...
Well, I'm not surprised.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
int pin_B = 0;
int pin_X = 1;
These are the serial pins, you know. If you are doing Serial I/O (and you are), you can't expect to use them with LEDs, too.
I'm not using them to drive LEDs they're integrated with a USB game controller the game controller simply needs a logic high or logic low.
I know when the Arduino is "pushing" a button because I have the controller plugged into my computer with a simple test program that shows when a button is being pushed.
Quote
when I run my new function instead, which loops through an array and should be doing the exact same thing as "doStuff" the pin for pin_B, and pin_X don't work...
Well, I'm not surprised.
I still don't understand, maybe you could explain to me why these outputs work as desired when I call
"digitalWrite(pin_B, LOW);" in the "doStuff" function but not when I call
"digitalWrite(pin_B, LOW);" in the "runSeq" function.
« Last Edit: December 30, 2012, 10:02:29 am by twistedsymphony » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49080
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I still don't understand, maybe you could explain to me why these outputs work as desired when I call
"digitalWrite(pin_B, LOW);" in the "doStuff" function but not when I call
"digitalWrite(pin_B, LOW);" in the "runSeq" function.
In the code that calls doStuff, you do not have an instance of the Serial class using pins 0 and 1. In the runSeq code, you do. Pins 0 and 1 can be used for general I/O OR serial. They can not be used for both.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

AHH! thank you thank you!

I didn't realize that those serial commands used the actual serial O/I pins, I thought it was just using the USB port as a serial interface, now it all makes sense.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18732
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The main processor doesn't have a USB port, so it uses the two serial pins to reach the USB interface chip.
Logged


Pages: 1 [2]   Go Up
Jump to: