Go Down

Topic: AS3Glue: Send commands to OneWire Thermometer (Read 2967 times) previous topic - next topic



I am trying to get the Dallas Semiconductor DS18B20 Digital Thermometer (http://www.arduino.cc/playground/Learning/OneWire) to communicate with Flash AS3 via the AS3Glue protocol and Firmata 2.0.

For those of you who may be a bit fuzzy about this, here's a quick breakdown.

  • OneWire is attached to an Arduino Digital Pin
    Firmata 2.0 is on the Arduino
    The Firmata sends data to Flash via the SerProxy application
    Flash communicates with Firmata via the AS3Glue library

Sooo... In Flash, I am trying to send "ds.write(0xBE);" to the OneWire using something like the arduino.writeDigitalPin () function. :-?

The working arduino code has this main bit: (The full code is attached.)

Code: [Select]
 ds.write(0x44,1);         // Start Converting Temp Data


 present = ds.reset();
 ds.write(0xBE);         // Read Temp Data

 for ( i = 0; i < 9; i++) {           // we need 9 bytes
     data[i] = ds.read();

In flash, I have this (doesn't work...yet):
Code: [Select]

var timer6:Timer = new Timer(600,1);
var resetT:String = "ds.reset()";
var startConversion:String = "ds.write(0x44,1)";
var getConversion:String = "ds.write(0xBE)";

function setUpTherm (e:Object):void {
   timer6.addEventListener("timer", getTemp);

function getTemp(e:TimerEvent) {
   for ( i = 0; i < 9; i++) {           // we need 9 bytes
       data[i] = arduino.writeDigitalPin(8,("ds.read()"));
   temperature.text = CTemp.toString();                                                  

This taps into a bigger question of how to send info to the digital pins from Flash using more than just HIGH or LOW commands.

Please throw in your 2 cents!! Thanks so much!!

HERE ARE THE FILES:  http://rapidshare.com/files/188937417/OneWire.zip.html

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131