Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumWiring HardwareTroubleshooting › values written (print) to the Serial not matching.

Page Index Toggle Pages: 1
values written (print) to the Serial not matching. (Read 3116 times)
03/25/07 at 18:24:35

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
I have a photo resister hooked up to the Wiring board.. The board writes values to  Serial. I'm using Processing to read the serial.. and the values doesn't match...

Shouldn't it match?

from Wiring serial monitor I get values from 100-900..
from Processing, I get values form 50-70

 
IP Logged
 
Reply #1 - 03/26/07 at 02:30:43

mistergreen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 15
*
 
it was an issue with analog & digital conversion..
I just did Serial.print(val, BYTE)

things seem to work better.
 
IP Logged
 
Reply #2 - 03/26/07 at 05:03:34

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
Remember the analog input gives you values in the range 0..1023
the BYTE takes values in the range 0..255, so you could converte the analog values to the 0..255 range to avoid conversion on the processing side by doing:

Serial.print(val/4, BYTE);
 
IP Logged
 
Page Index Toggle Pages: 1