Skip to content

Instantly share code, notes, and snippets.

@Measter
Created May 21, 2020 22:02
Show Gist options
  • Save Measter/a390c8eabe334d6f52207f6402168cbb to your computer and use it in GitHub Desktop.
Save Measter/a390c8eabe334d6f52207f6402168cbb to your computer and use it in GitHub Desktop.
#include <Arduino.h>
#include "strong_io.h"
IO::PWM<Pin::D3> output1;
IO::DigitalOut<Pin::D4> output2;
IO::DigitalIn<Pin::D2> input1;
IO::AnalogIn<Pin::A0> input2;
void setup() {
}
void loop() {
output1.set_duty(128);
output2.write(PinState::Low);
input1.read();
input2.read();
}
////// Build Output
Compiling .pio\build\nanoatmega328\src\new_blink.cpp.o
Linking .pio\build\nanoatmega328\firmware.elf
Building .pio\build\nanoatmega328\firmware.hex
Checking size .pio\build\nanoatmega328\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 0.4% (used 9 bytes from 2048 bytes)
Flash: [ ] 1.8% (used 554 bytes from 30720 bytes)
#include <Arduino.h>
const int output1 = 3;
const int output2 = 4;
const int input1 = 2;
const int input2 = A0;
void setup() {
pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(input1, INPUT);
// The new IO code does this for analog pins to ensure they're in a known state.
pinMode(input2, INPUT);
}
void loop() {
analogWrite(output1, 128);
digitalWrite(output1, LOW);
digitalRead(input1);
analogRead(input2);
}
////// Build Output
Compiling .pio\build\nanoatmega328\src\new_blink.cpp.o
Linking .pio\build\nanoatmega328\firmware.elf
Building .pio\build\nanoatmega328\firmware.hex
Checking size .pio\build\nanoatmega328\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 0.4% (used 9 bytes from 2048 bytes)
Flash: [ ] 3.6% (used 1116 bytes from 30720 bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment