User Tools

Site Tools


snd_serialread_arduino

This is an old revision of the document!



Warning: Declaration of syntax_plugin_wrap_div::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/div.php on line 43

Warning: Declaration of syntax_plugin_wrap_div::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/div.php on line 81

Warning: Declaration of syntax_plugin_wrap_closesection::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/closesection.php on line 23

Warning: Declaration of syntax_plugin_wrap_closesection::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/closesection.php on line 29

Warning: Declaration of syntax_plugin_wrap_span::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/span.php on line 43

Warning: Declaration of syntax_plugin_wrap_span::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/span.php on line 63

Warning: Declaration of syntax_plugin_gallery::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/gallery/syntax.php on line 51

Warning: Declaration of syntax_plugin_gallery::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/gallery/syntax.php on line 147

Warning: Declaration of syntax_plugin_vshare::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/vshare/syntax.php on line 47

Warning: Declaration of syntax_plugin_vshare::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/vshare/syntax.php on line 107

Warning: preg_match(): Compilation failed: invalid range in character class at offset 3444 in /var/www/kucjica/emperors-wiki/inc/parser/lexer.php on line 118
A PCRE internal error occured. This might be caused by a faulty plugin

SND serial read > arduino <code c++> //create a simple melody //this melody will play first when you upload the code // notes in the melody (defined in pitches.h) int melody[] = { 24, 32,32, 165, 220,0, 440, 180}; // note durations: 4 = quarter note, 8 = eighth note, etc.: int noteDurations[] = { 4, 8, 8, 4,4,4,4,4 }; int incomingByte = 0; // incoming serial data int duration = 0; int snd = 8; // speaker pin void setup() { // iterate over the notes of the melody: Serial.begin(9600); // opens serial port, sets data rate to 9600 bps //pinMode(snd, OUTPUT); for (int thisNote = 0; thisNote < 8; thisNote++) { int noteDuration = 1000/noteDurations[thisNote]; tone(8, melody[thisNote],noteDuration); int pauseBetweenNotes = noteDuration * 1.30; delay(pauseBetweenNotes); // stop the tone playing: noTone(8); } } void loop() { // send data only when you receive data: if (Serial.available() > 0) { // read the incoming byte: incomingByte = Serial.read(); tone(snd, incomingByte,100); } } </code>

snd_serialread_arduino.1390480600.txt.gz · Last modified: 2014/01/23 12:36 by zoza