cottewmi:
Name is Mitch, trying to advance my skills with arduino before attempting larger project (raspberry pi and arduino robot)making a simple Light Dependant Resistor(LDR) operated synth; my intent is to simply convert the last number in the analog value of the ldr into one of 10 notes in the d minor scale. board is wired, and, to the best of my ability, my code is written, but I can see I am making plenty of mistakes in my coding; i need to learn the intricacies of arduino, and i am already past the absolute beginner stage, and want to progress into the amateur stage. please help me find the glaring errors in my programming so I may improve!
/*
Education through Hard Programming
LDR Based SYNTHESIZER
plays basic scales based on feedback from LDR
Written By Mitchell Cottew
*/
#include "pitches.h"
int LDR = A5;
int out = pin3;
int LDRVal = 0;
void setup() {
// digital pin as output;
// analog pin as input;
// maybe i should do serialout too just so i know whats goin on;
pinMode(out,OUTPUT);
pinMode(LDR,INPUT);
}
void loop() {
int LDRVal = analogRead(LDR);
int musicValue = LDRVal % 10;
//read LDR and turn it into simple number
if ((musicValue) == 0);
{tone(294)};
if ((musicValue) == 1);
{tone(330)};
if ((musicValue) == 2);
{tone(349)};
if ((musicValue) == 3);
{tone(392)};
if ((musicValue) == 4);
{tone(440)};
if ((musicValue) == 5);
{tone(446)};
if ((musicValue) == 6);
{tone(523)};
if ((musicValue) == 7);
{tone(587)};
if ((musicValue) == 8);
{tone(659)};
if ((musicValue) == 9);
{tone(698)};
if ((musicValue) == 0);
{tone(784)};
delay(20);
noTone;
delay(5);
;
}
I thought I was close with this; i got many errors. what can i do?
is this satisfactory? i apologize, i am unfamiliar with forum use