analog card
This commit is contained in:
parent
1f8ad10609
commit
51e9f5258a
2 changed files with 52 additions and 19 deletions
|
@ -1,19 +1,38 @@
|
|||
#include <ESPMegaPRO.h>
|
||||
#include <DigitalInputCard.hpp>
|
||||
#include <DigitalOutputCard.hpp>
|
||||
#include <AnalogCard.hpp>
|
||||
|
||||
DigitalInputCard icard = DigitalInputCard(0x20, 0x21);
|
||||
// This code demonstrates how to use the cards
|
||||
|
||||
DigitalInputCard icard = DigitalInputCard(0x21, 0x22);
|
||||
DigitalOutputCard ocard = DigitalOutputCard(0x5F);
|
||||
AnalogCard acard = AnalogCard();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
// Instantiate Input Card
|
||||
icard.begin();
|
||||
// Instantiate Output Card
|
||||
ocard.begin();
|
||||
// Instantiate Analog Card
|
||||
acard.begin();
|
||||
// Set output 0 to 4095
|
||||
ocard.analogWrite(0, 4095);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
for (int i = 0; i < 16; i++) {
|
||||
Serial.print("Input ");
|
||||
Serial.print(i);
|
||||
Serial.print(": ");
|
||||
Serial.print(icard.digitalRead(i));
|
||||
Serial.println();
|
||||
}
|
||||
// Pad the output
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
// Delay for 1 second
|
||||
delay(1000);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue