Advertisement
DrAungWinHtut

TwoAnalogSensorReadingFromOnePort.ino

Sep 29th, 2022
1,330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // C++ code
  2. // Dr. Aung Win Htut
  3. void setup()
  4. {
  5.   pinMode(A0, INPUT);
  6.   pinMode(2,OUTPUT);
  7.   pinMode(3,OUTPUT);
  8.   Serial.begin(9600);
  9. }
  10.  
  11. void loop()
  12. {
  13.   digitalWrite(2,HIGH);
  14.   digitalWrite(3,LOW);
  15.   int sensor = analogRead(A0);
  16.   Serial.print("Force Sensor Input Reading is : ");
  17.   Serial.println(sensor);
  18.   sensor=0;
  19.   delay(1000);
  20.   digitalWrite(3,HIGH);
  21.   digitalWrite(2,LOW);
  22.   sensor = analogRead(A0);
  23.   Serial.print("Flex Sensor Input Reading is : ");
  24.   Serial.println(sensor);
  25.   sensor=0;
  26.   delay(1000);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement