Piezo Tutorial - #define music notes fails
sdiguana
Posts: 11
Im working through the piezo tutorial and was quite amused by the musical notes part of it. However, when i try the part on the bottom of the page which suggests to define the notes as variables, my code fails. what am i doing wrong?
Tutorial link: Here
Compiler Error:
edit: Thanks twm .. the equals sign was the problem!
Tutorial link: Here
Compiler Error:
Piezo.c: In function 'main': Piezo.c:20:15: error: expected expression before '=' token Done. Build Failed!
/* Piezo Beep.c Beep a piezo speaker connected to P4. */ #include "simpletools.h" // Include simpletools #define C6 = 1047 #define D6 = 1175 #define E6 = 1319 #define F6 = 1397 #define G6 = 11568 #define A6 = 1760 #define B6 = 1976 #define C7 = 2093 int note[] = {C6, D6, E6}; int main() // main function { for (int i = 0; i<(sizeof(note)/sizeof(int)); i++) { freqout(4, 500, note[i]); // pin, duration, frequency pause(68); } }
edit: Thanks twm .. the equals sign was the problem!
Comments
Tom