DJI-Gimbal-FOC/src/main.cppfr

38 lines
795 B
Plaintext

// Test file
#include <Arduino.h>
const int analogInPin = A2; // Analog input pin that the potentiometer is attached to
//const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int maxValue = 200;
int minValue = 200;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(115200);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
if(sensorValue > maxValue)
{
maxValue = sensorValue;
}
else if(sensorValue < minValue)
{
minValue = sensorValue;
}
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t min=");
Serial.print(minValue);
Serial.print("\tmax=");
Serial.println(maxValue);
delay(2);
}