Stock workshop Robotics and Modular Machines:: Difference between revisions
(→code) |
(→code) |
||
Line 10: | Line 10: | ||
==code== | ==code== | ||
1. programming logic: | 1. programming logic: | ||
[[image:IMG 3115.JPG|500px]] | [[image:IMG 3115.JPG|500px]] | ||
[[image:IMG 3119.JPG|500px]] | [[image:IMG 3119.JPG|500px]] | ||
[[image:IMG_3120.JPG|500px]] | [[image:IMG_3120.JPG|500px]] | ||
Revision as of 13:53, 16 March 2013
Robotics and Modular Machines
Hello Arduino!!!
Hello Mr.Stock!!!!
code
1. programming logic:
2. the code.
a.without musical scale b,with musical scale
3. c
hardware
1. Arduino nano ( volume control. analog inputs,)
2. sensors
learning process
1. AC DC
2. H-bridge
document photos...
for optical instrument
code:
//no moter //sensor pin const int ldrPin = A1;
//light pin const int ledPin = 13; //speaker pin const int speakerPin = 9;
void setup(){
Serial.begin(115200); // using those pins as output
pinMode(ledPin, OUTPUT); pinMode(speakerPin, OUTPUT);
}
void loop() {
int ldrVal = analogRead(ldrPin); //map the value of the light sensor ldrVal = map(ldrVal, 170, 600, 0, 1023); //constrain the vaule from 0 to 1023 ldrVal = constrain(ldrVal, 0, 1023);
// turning on the led
digitalWrite(ledPin, HIGH);
Serial.println(ldrVal);
makeTone(ldrVal);
}
void makeTone(int freq){
digitalWrite(speakerPin, HIGH); delayMicroseconds(freq); digitalWrite(speakerPin, LOW); delayMicroseconds(freq);
}
Hardware:
white board :
1. 2. 3. 4.
5. 6. 7.