Browse Source

Fixed the definition of resolution in Arduino file to prevent naming collisions with timer1

pull/4/head
Jeffery R 6 years ago
parent
commit
b8d357ee77
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      entries/projects/musical-floppy-drive-build-log.md

+ 4
- 3
entries/projects/musical-floppy-drive-build-log.md View File

@ -149,6 +149,7 @@ Open up your Arduino software and paste the following code in the editor:
``` ```
#include <TimerOne.h> #include <TimerOne.h>
#define RESOLUTION1 40
boolean firstRun = true; // Used for one-run-only stuffs; boolean firstRun = true; // Used for one-run-only stuffs;
@ -182,8 +183,8 @@ int currentState[] = {
0,0,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW 0,0,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW
}; };
//Current period assigned to each pin. 0 = off. Each period is of the length specified by the RESOLUTION
//variable above. i.e. A period of 10 is (RESOLUTION x 10) microseconds long.
//Current period assigned to each pin. 0 = off. Each period is of the length specified by the RESOLUTION1
//variable above. i.e. A period of 10 is (RESOLUTION1 x 10) microseconds long.
unsigned int currentPeriod[] = { unsigned int currentPeriod[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
}; };
@ -215,7 +216,7 @@ void setup(){
pinMode(16, OUTPUT); // Step control 8 pinMode(16, OUTPUT); // Step control 8
pinMode(17, OUTPUT); // Direction 8 pinMode(17, OUTPUT); // Direction 8
Timer1.initialize(RESOLUTION); // Set up a timer at the defined resolution
Timer1.initialize(RESOLUTION1); // Set up a timer at the defined resolution
Timer1.attachInterrupt(tick); // Attach the tick function Timer1.attachInterrupt(tick); // Attach the tick function
Serial.begin(9600); Serial.begin(9600);

Loading…
Cancel
Save