POTENTIOMETER AS ANGLE SENSOR

Tasks:

  1. Add the potentiometer to the shaft of barrier gate. You can follow the instrucions in the video.

Adding potenciometer as an angle sensor.{#fig:pot_sen}

  1. Test the potentiometer values with next program:
void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(analogRead(A3));
  delay(100);
}
  1. Change the functions for lifting and lowering the barrier gate to use potenciometer readings instead of switch and time controlled movement.
[+] void setup() {   
[+] void loop() {
[+] void manualGateControll(){
[+] void stopTheGate(){
[-] void moveGateUp() {
        int gate_orientation = analogRead(POTENTIOMETER_PIN);
        while (gate_orientation < 750){
            digitalWrite(MOTOR_PIN_1, HIGH);
            digitalWrite(MOTOR_PIN_2, LOW);
            gate_orientation = analogRead(POTENTIOMETER_PIN);
        }
        stopTheGate(); 
    }
[+] void moveGateDown() {
  1. Advanced: Calculate the angle of barrier gate from the analog readings of potenciometer.

Questions:

  1. What is the value of the angle sensor when the barrier gate is in the upper orientation...
  2. ... and in lower orientation.

Summary:

<++>

<++>

Issues:

<++>

<++>