mirror of
https://github.com/KevinMidboe/Arduino.git
synced 2025-10-29 17:40:11 +00:00
Init commit with many years of arduino sketches and projects. I dont know if the esp8266 includes much, but there are also libraries. I hope they dont have crazy automatic versioning through the Arduino IDE.
This commit is contained in:
25
Projects/ProgLab/Instrument/Instrument.ino
Normal file
25
Projects/ProgLab/Instrument/Instrument.ino
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <Servo.h>
|
||||
|
||||
Servo myservo;
|
||||
|
||||
int potpin = 0;
|
||||
int potReading;
|
||||
int photocellPin = 1;
|
||||
int photocellReading;
|
||||
|
||||
void setup()
|
||||
{
|
||||
myservo.attach(9);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
potReading = analogRead(potpin);
|
||||
potReading = map(potReading, 0, 1023, 0, 179);
|
||||
myservo.write(potReading);
|
||||
photocellReading = analogRead(photocellPin);
|
||||
|
||||
int thisPitch = map(photocellReading, 1, 1000, 120, 1500);
|
||||
tone(8, thisPitch, 10);
|
||||
delay(1);
|
||||
}
|
||||
Reference in New Issue
Block a user