The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

douglasv (316) [Avatar] Offline
the serial monitor outputs serial enigmas

the sketch doesn't contain any code that would produce the output
shown in Figure 2.13

I'm using debian squeeze 64bit on oracle's vm virtualbox
I use sudo ant run;

A few typo's along the way, but It looks like we are going to
get a thorough understanding, I'm enjoying the book .
martin.evans (25) [Avatar] Offline
Re: pdf page 46
Hi I think the gremlins must have got in. Thanks for pointing it out. Here is the correct listing below.

volatile int state = 0;
int ledArray[] = {8, 9, 10, 11, 12};
int count = 0;
int timer = 50;
int stopLed = 6;
int goLed = 7;
int randMin = 250;
int randMax = 750;
int startDelay;
volatile float time;
float start_time;

void setup(){
for (count=0;count<5;count++){
pinMode(ledArray[count], OUTPUT);
attachInterrupt(0, halt, RISING);
pinMode(stopLed, OUTPUT);
pinMode(goLed, OUTPUT);

void loop(){
//start state
if (state == 0) {
digitalWrite(stopLed, HIGH);
digitalWrite(goLed, LOW);
for (count=0;count<5;count++){
digitalWrite(ledArray[count], LOW);
// start button pressed
if (state == 1) {
// random start
startDelay = random(randMin,randMax);
start_time = millis();
digitalWrite(stopLed, LOW);
digitalWrite(goLed, HIGH);
for (count=0;count<5;count++){
if (state == 2) {
time = (time - start_time)/1000;
Serial.print("Reaction time: ");
Serial.println(" seconds");
digitalWrite(ledArray[count], HIGH);


void halt() {
state = state++;
if (state == 2){
time = millis();
if (state == 3) {
state = 0;
douglasv (316) [Avatar] Offline
Re: pdf page 46
The arduino ide works fine in windows 7, so far.

But, in debian squeeze, 64 bit, the arduino ide uploads fine,
then suddenly, without any obvious reason, it fails to upload,

dmesg: confirms that arduino UNO is recognized.

also,during the failed upload, the L,TX,RX as well
as the led in pin 13 blink on and off,so it's sending something to the board, but, it looks like the board
doesn't understand what it is.

I use the ide with sudo ant run.
I checked the forums and didn't see anything similar to my debian mystery.

Is this a known issue?
martin.evans (25) [Avatar] Offline
Re: pdf page 46
Can you tell me which version of the IDE are you using and which Arduino model
douglasv (316) [Avatar] Offline
Re: pdf page 46
idProduct 0001
cdc_acm 2-2:1.0

Thank you