This code reads a Devantech SRF02 ultrasonic ranger (and probably an SRF08 and SRF10 as well) It uses the Wire library for Wiring and Arduino.
Continue reading “Devantech SRF02, 08, 10 Ultrasonic Ranger reader”
code and fabrication resources for physical computing and networking
This code reads a Devantech SRF02 ultrasonic ranger (and probably an SRF08 and SRF10 as well) It uses the Wire library for Wiring and Arduino.
Continue reading “Devantech SRF02, 08, 10 Ultrasonic Ranger reader”
Need to write incoming bytes from a serial port to a text file? On a Unix or Linux machine (or OSX), you can do the following:
Working with the Maxstream Xbee radios on OSX can be annoying because the screen program doesn’t print a linefeed automatically when it receives a carriage return. This Processing program works as a serial terminal program, but inserts a linefeed when it gets a carriage return.
Technorati Tags: networked objects, networks, XBee
The Devantech SRF04 and SRF05 ultrasonic sensors are easy to use and reasonably accurate distance ranging sensors. To use them, you send the sensor s pulse of 10 microseconds on its INIT pin. Then the sensor sends out an ultrasonic pulse and waits for the pulse to bounce off something and return an echo. The sensor then pulses its ECHO pin. The length of the pulse in microseconds is proportional to the distance of the object from the sensor. The code below reads a Devantech sensor on an Arduino or Wiring module.
Dan Shiffman’s written a nice library to access the sudden motion sensor on the macbook and macbook pro. He based it on a couple other open source libraries. Below is a code sample for it that draws a plane on the screen and moves it as you tilt the computer.
This Processing sketch controls the playback of a Quicktime movie using serial data. To use it, send a serial value from 0 – 255. The movie position will be set based on that value. 0 = beginning of movie, 255 = end of movie. It doesn’t matter what’s sending the serial data, as long as the value is between 0 and 255.
Hans Steiner, God of PD/USB and a darn nice guy, has released PDuino. In his words:
“Here’s the first test release of Pduino, a Pd firmware for Arduinoand a matching Pd object, . This allows you get data from the digital and analog inputs, and send data to the PWM and digital outputs. It also allows you to change the digital pins from input, output, or PWM. And you can choose how many analog inputs and turn on/off digital input.
“Keep in mind its a test release, the only thing I am not sure about right now is digitalInput, everything else seems to work fine. In the future, I’d like to figure out how to add the pulseIn feature.
“This firmware would work well with Processing, Max/MSP, Flash, whatever. Then the Arduino becomes a dead simple, cheap sensor box for the newbies, but still open for playing later.”
This program reads a serial string from a GPS reader. It parses the sentence and returns latitude and longitude.
It’s also a simple example of how to read an ASCII-formatted, comma-delimited serial protocol.
This code reads three sensors and sends them out serially when prompted by another computer. It works with this Processing example. Arduino/Wiring, PicBasic Pro, and BX-24 versions are shown.
Continue reading “Serial Call-and-Response (Microcontroller side)”
This program controls a stepper motor from an analog input. In testing it, I used a potentiometer, which gives a persistent value. An analog input that changes when it’s not contacted, like a SpectraSymbol linear or circular pot, wouldn’t work with this example.
Thanks to the Fall ’05 Wednesday morning class for the early experimentation on this code.
Written in PicBasic Pro, tested on a PIC18F252
Continue reading “Stepper motor controller from analog input”