Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int pot = 0; //potentiometer variable
- //adding for a photoresistor
- int pressure = 0;
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600); // initialize serial
- }
- void loop() {
- // put your main code here, to run repeatedly:
- pot = analogRead(A0);
- pressure = analogRead(A1);
- Serial.println(pot);
- Serial.print(" pressure ");
- Serial.println(pressure);
- int lightVals = map(pot, 0, 1023, 0, 255);
- int light2Vals = map(pressure, 0, 1007, 0, 255);
- analogWrite(10, lightVals);
- analogWrite(9, light2Vals);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement