Download Print this page

Intel Galileo Hardware Manual page 20

Biobots
Hide thumbs Also See for Galileo:

Advertisement

Hardware
Notice that things without quotations have to be variables, while things with them will just be printed as
words or text. The backslash chracter tells the microcontroller it is a special character such as tab, new line, or
another thing (see this table:
aspx
although not all of these are implemented in Galileo).
You can see these, by opening up tools->Serial Monitor (Lesson 3, Figure 5), after uploading a program with
serial stuff onto the Galileo. (Remember to put some delay in your loop or you'll back up the serial buffer.) In
other words, you want to get the microcontroller to display values.
For my program I wanted to see the read analog value, and the value I was putting out, so I changed the
program around a bit:
void setup(){
Serial.begin(9600); //set up serial
pinMode(A0, INPUT); // analog sensor
pinMode(3, OUTPUT); //led indicator
}
void loop(){
int readValue; //value read from sensor
int writtenValue; //value written to led
readValue = analogRead(A0); //read the value from the analog
sensor
writtenValue = map(readValue, 200, 1000, 0, 255); //The 200
and the 1000 are from observing the range of values from my sensor
//continued on next page ------->
http:/ /msdn.microsoft.com/en-us/library/h21280bw%28v=vs.80%29.
Lesson 3, Figure 5
Hardware 20

Advertisement

loading