Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit c714457

Browse files
committed
Example names and rewritten digital input example
Example names and rewritten digital input example to print all channels
1 parent 03a28a5 commit c714457

File tree

12 files changed

+422
-125
lines changed

12 files changed

+422
-125
lines changed

examples/DigitalInputExample/DigitalInputExample.ino

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Automation Carrier - Digital Input Example
3+
4+
This sketch shows how to periodically read from all the DIGITAL
5+
INPUTS channels on the Automation Carrier.
6+
7+
The circuit:
8+
- Portenta H7
9+
- Automation Carrier
10+
11+
created 25 August 2020
12+
by Silvio Navaretti
13+
modified 29 September 2020
14+
by Riccardo Rizzo
15+
modified 6 October 2020
16+
by Silvio Navaretti
17+
This example code is in the public domain.
18+
*/
19+
#include <AutomationCarrier.h>
20+
21+
using namespace automation;
22+
uint16_t readings = 0;
23+
24+
void setup() {
25+
Serial.begin(9600);
26+
//The loop starts only when the serial monitor is opened.
27+
while(!Serial);
28+
}
29+
30+
void loop() {
31+
//Read all channels
32+
readings = digital_inputs.readAll();
33+
//Print all channels as binary numb
34+
Serial.print("DIGITAL INPUT, all channels, binary: ");
35+
Serial.println(readings, BIN);
36+
37+
//Read one-by-one each channel and print them one-by-one
38+
39+
readings = digital_inputs.read(0);
40+
Serial.println("CH0: "+String(readings));
41+
42+
readings = digital_inputs.read(1);
43+
Serial.println("CH1: "+String(readings));
44+
45+
readings = digital_inputs.read(2);
46+
Serial.println("CH2: "+String(readings));
47+
48+
readings = digital_inputs.read(3);
49+
Serial.println("CH3: "+String(readings));
50+
51+
readings = digital_inputs.read(4);
52+
Serial.println("CH4: "+String(readings));
53+
54+
readings = digital_inputs.read(5);
55+
Serial.println("CH5: "+String(readings));
56+
57+
readings = digital_inputs.read(6);
58+
Serial.println("CH6: "+String(readings));
59+
60+
readings = digital_inputs.read(7);
61+
Serial.println("CH7: "+String(readings));
62+
63+
Serial.println();
64+
delay(250);
65+
}

examples/FullTest/FullTest.ino

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)