Skip to content

Commit

Permalink
fix: delayMicroseconds intervals
Browse files Browse the repository at this point in the history
Updated delayMicroseconds calls to respect Arduino documentation
  • Loading branch information
zfields committed Jan 21, 2021
1 parent 3b762ef commit cc145fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=NesRob
version=1.0.0
version=1.0.2
author=Zachary J. Fields
maintainer=Zachary J. Fields <zachary_fields@yahoo.com>
sentence=Manipulates LED to signal NES R.O.B. (Robot Operating Buddy)
Expand Down
15 changes: 13 additions & 2 deletions src/NesRob_Arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,25 @@ NesRob::blinkCommand (
Command command_
) {
// Send initialization sequence
::delayMicroseconds(66666); // 0000 (required delay between commands)
// Max delay of 16383 guaranteed by Arduino reference
// https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/
{
::delayMicroseconds(16383);
::delayMicroseconds(16383);
::delayMicroseconds(16383);
::delayMicroseconds(16383);
::delayMicroseconds(1134);
} // 0000 (required delay between commands)
{
::digitalWrite(_led_pin, HIGH);
::delayMicroseconds(1500);
::digitalWrite(_led_pin, LOW);
::delayMicroseconds(15166);
} // 1
::delayMicroseconds(16666); // 0
{
::delayMicroseconds(16383);
::delayMicroseconds(283);
} // 0

// Flash command sequence
for (int i = 7 ; i >= 0 ; --i) {
Expand Down

0 comments on commit cc145fc

Please sign in to comment.