Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Michael Montella
- // Lab 4
- int pot = A0;
- int bendSensor = A1;
- int val = 0; // variable for sensor value
- int val2 = 0;
- void setup() {
- Serial.begin(9600); // initialize serial communication
- }
- void loop() {
- val = analogRead(pot); // reading analog value
- // Use a small delay between analogRead functions for different sensors
- // Allows the ADC to catch up
- delay(10);
- val2 = analogRead(bendSensor);
- analogWrite(9, val/4);
- analogWrite(10, map(val2, 0, 10, 0, 255));
- Serial.println(val2); // print serial number
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement