Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Baltimore Node Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Workshop1
(section)
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Preview
Advanced
Special characters
Help
Heading
Level 2
Level 3
Level 4
Level 5
Format
Insert
Latin
Latin extended
IPA
Symbols
Greek
Greek extended
Cyrillic
Arabic
Arabic extended
Hebrew
Bangla
Tamil
Telugu
Sinhala
Devanagari
Gujarati
Thai
Lao
Khmer
Canadian Aboriginal
Runes
Á
á
À
à
Â
â
Ä
ä
Ã
ã
Ǎ
ǎ
Ā
ā
Ă
ă
Ą
ą
Å
å
Ć
ć
Ĉ
ĉ
Ç
ç
Č
č
Ċ
ċ
Đ
đ
Ď
ď
É
é
È
è
Ê
ê
Ë
ë
Ě
ě
Ē
ē
Ĕ
ĕ
Ė
ė
Ę
ę
Ĝ
ĝ
Ģ
ģ
Ğ
ğ
Ġ
ġ
Ĥ
ĥ
Ħ
ħ
Í
í
Ì
ì
Î
î
Ï
ï
Ĩ
ĩ
Ǐ
ǐ
Ī
ī
Ĭ
ĭ
İ
ı
Į
į
Ĵ
ĵ
Ķ
ķ
Ĺ
ĺ
Ļ
ļ
Ľ
ľ
Ł
ł
Ń
ń
Ñ
ñ
Ņ
ņ
Ň
ň
Ó
ó
Ò
ò
Ô
ô
Ö
ö
Õ
õ
Ǒ
ǒ
Ō
ō
Ŏ
ŏ
Ǫ
ǫ
Ő
ő
Ŕ
ŕ
Ŗ
ŗ
Ř
ř
Ś
ś
Ŝ
ŝ
Ş
ş
Š
š
Ș
ș
Ț
ț
Ť
ť
Ú
ú
Ù
ù
Û
û
Ü
ü
Ũ
ũ
Ů
ů
Ǔ
ǔ
Ū
ū
ǖ
ǘ
ǚ
ǜ
Ŭ
ŭ
Ų
ų
Ű
ű
Ŵ
ŵ
Ý
ý
Ŷ
ŷ
Ÿ
ÿ
Ȳ
ȳ
Ź
ź
Ž
ž
Ż
ż
Æ
æ
Ǣ
ǣ
Ø
ø
Œ
œ
ß
Ð
ð
Þ
þ
Ə
ə
Formatting
Links
Headings
Lists
Files
Discussion
References
Description
What you type
What you get
Italic
''Italic text''
Italic text
Bold
'''Bold text'''
Bold text
Bold & italic
'''''Bold & italic text'''''
Bold & italic text
Description
What you type
What you get
Reference
Page text.<ref>[https://www.example.org/ Link text], additional text.</ref>
Page text.
[1]
Named reference
Page text.<ref name="test">[https://www.example.org/ Link text]</ref>
Page text.
[2]
Additional use of the same reference
Page text.<ref name="test" />
Page text.
[2]
Display references
<references />
↑
Link text
, additional text.
↑
Link text
=== TwitterReader.pde === <pre> /* * Serial RGB LED TOO * ------------------ * Serial commands control the brightness of R,G,B LEDs * * Command structure is "#RRGGBB" * * * Created 18 October 2006 * copyleft 2006 Tod E. Kurt <tod@todbot.com * http://todbot.com/ */ #define slen 7 // 7 characters, e.g. '#ff6666' char serInStr[slen]; // array to hold the incoming serial string bytes int redPin = 9; // Red LED, connected to digital pin 9 int greenPin = 10; // Green LED, connected to digital pin 10 int bluePin = 11; // Blue LED, connected to digital pin 11 void setup() { pinMode(redPin, OUTPUT); // sets the pins as output pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); Serial.begin(9600); analogWrite(redPin, 127); // set them all to mid brightness analogWrite(greenPin, 127); // set them all to mid brightness analogWrite(bluePin, 127); // set them all to mid brightness Serial.println("enter color command (e.g. '#ff3333') :"); } void loop () { //read the serial port and create a string out of what you read int spos = readSerialString(); if(spos==slen && serInStr[0] == '#') { long colorVal = strtol(serInStr+1,NULL,16); Serial.print("setting color to r:"); Serial.print((colorVal&0xff0000)>>16); Serial.print(" g:"); Serial.print((colorVal&0x00ff00)>>8); Serial.print(" b:"); Serial.println((colorVal&0x0000ff)>>0); memset(serInStr,0,slen); // indicates we've used this string //spos = 0; analogWrite(redPin, (colorVal&0xff0000)>>16 ); analogWrite(greenPin, (colorVal&0x00ff00)>>8 ); analogWrite(bluePin, (colorVal&0x0000ff)>>0 ); } delay(200); // wait a bit, for serial data } //read a string from the serial and store it in an array int readSerialString () { int i=0; if(!Serial.available()) { return -1; } while (Serial.available() && i < slen) { int c = Serial.read(); serInStr[i++] = c; } Serial.println(serInStr); return i; } </pre>
Summary:
Please note that all contributions to Baltimore Node Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Baltimore Node Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)