TrashNotes

2025-02-12 20:59:04
"Arduino PRO micro" test
pro-micro-test.c
const int AxInputs[] = { A0, A1, A2, A3 };
const int DxInputs[] = { 2, 3, 4, 5, 6, 7 };
 
 
void setup() {
  for (int i = 0; i < sizeof(AxInputs) / sizeof(AxInputs[0]); ++i) {
    pinMode(AxInputs[i], INPUT);
  }
 
  for (int i = 0; i < sizeof(DxInputs) / sizeof(DxInputs[0]); ++i) {
    pinMode(DxInputs[i], OUTPUT);
  }
 
   Serial.begin(115200);
}
 
void loop() {
  for (int i = 0; i < sizeof(DxInputs)/ sizeof(DxInputs[0]) ; ++i) {
    digitalWrite(DxInputs[i], HIGH);
    delay(10);
    delay(10);
    Serial.print(DxInputs[i]);
  }
 
  for (int i = (sizeof(DxInputs)/ sizeof(DxInputs[0]))-1 ; i >= 0 ; --i) {
    digitalWrite(DxInputs[i], HIGH);
    delay(10);
    digitalWrite(DxInputs[i], LOW);
    delay(10);
  Serial.print(DxInputs[i]); 
  }
 
  for (int i = 0; i < sizeof(AxInputs) / sizeof(AxInputs[0]); ++i) {
int   ttt = analogRead(AxInputs[i]);
    Serial.print(" "+String(ttt));
  }
delay(1000);
  Serial.println("  X");
 
}
← Previous Next →
Back to list