-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (34 loc) · 841 Bytes
/
main.cpp
File metadata and controls
46 lines (34 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifdef ARDUINO
#include <Arduino.h>
#else
#include <cstdio>
#endif
#include <Vector.h>
char storage[] = {'H', 'e', 'l', 'l', 'o', ' ', 'W',
'o', 'r', 'l', 'd', '!', '\r', '\n'};
Vector<char> vector(storage, sizeof(storage));
#ifdef ARDUINO
void setup() {
Serial.begin(115200);
Serial.println("Starting up.");
}
void loop() {
Serial.print("Vector size is ");
Serial.println(vector.size());
Serial.print("Vector content: ");
for (unsigned int i = 0; i < vector.size(); i++) {
Serial.print(vector.at(i));
}
delay(2000);
}
#else /* !defined(ARDUINO) */
int main(int argc, char **argv) {
puts("Starting up.");
printf("Vector size is %d\n", vector.size());
printf("Vector content: ");
for (unsigned int i = 0; i < vector.size(); i++) {
putchar(vector.at(i));
}
return 0;
}
#endif