In the cat graphing example in chapter 3 as published in the book, the comments say:

// if the sensor value is less than the threshold,
// and the previous value was greater, then the cat
// just left the mat
if (prevSensorValue >= threshold) {
   catOnMat = false;
}

According to the second comment, the condition should be “greater,” but actual code is “greater or equal.”

The comment is right and the code should be as follows:

// if the sensor value is less than the threshold,
// and the previous value was greater, then the cat
// just left the mat
if (prevSensorValue > threshold) {
   catOnMat = false;
}

Thanks to Shigeru Kobayashi for catching this.

 

In the Chapter 1 Simple Serial code as published in the book says:

// after a quarter of a second, turn the LED on:

It should say

// after a half of a second, turn the LED on:

Thanks to Shigeru Kobayashi for catching it.

Xport Pong Emulator

 Chapter 5, etech2008, Processing, Updates  Comments Off on Xport Pong Emulator
Mar 032008
 

This Processing sketch sends the same bytes as the Xport that’s configured for the networked Pong game in Chapter 5. It’s a handy way to connect a microcontroller to the server when you don’t have an Xport, or aren’t sure your Xport is working.

Continue reading »

Analog Output

 Arduino/Wiring, etech2008  Comments Off on Analog Output
Mar 012008
 
/*
 Analog output
 Language: Wiring/Arduino
 
 Reads an analog input and uses its value to dim an LED output
 Connections:
 analog sensor on analog input pins 0
 LED on digital pin 3
 */

Continue reading »

Simple Sensor Reader

 Arduino/Wiring, etech2008  Comments Off on Simple Sensor Reader
Mar 012008
 

This program reads two analog sensors and one digital sensor and prints them out. Use it for testing your sensors.

Continue reading »

Reading a Switch

 etech2008  Comments Off on Reading a Switch
Mar 012008
 

This program reads a switch (i.e. a digital input) and changes an LED only when the switch changes from off to on. You can modify it to count switch presses as well. There’s a digital input connected to Digital I/O pin 2, and an LED attached to digital I/O pin 3. I refer to this method of detecting when the switch has changed as edge detection on a switch

Continue reading »

© 2012 Making Things Talk Suffusion theme by Sayontan Sinha