/*
 * SmartPin.ino
 * 
 * Experimenting with the idea of an object-oriented pin class
 * that uses operator overloading to intuitively abbreviate the 
 * usage of digitalRead(...), digitalWrite(...), analogRead(...)
 * and analogWrite(...)
 * 
 * version 1.0 Feb 2024 trent m. wyatt
 * 
 */

#include <SmartPin.h>

enum MagicNumbers {
    // project-specific pin usage; Change as needed
    BUTTON_PIN =  2,        // a digital input pin wth a push button
    POT_PIN    = A0,        // an analog input pin with a potentiometer
    LED1_PIN   =  3,        // a digital output to follow the button
    LED2_PIN   =  5,        // an analog output to follow the potentiometer

};  // enum MagicNumbers

// a push button that drives an LED
SmartPin  const button_pin(BUTTON_PIN, INPUT_PULLUP);
SmartPin  led1_pin(LED1_PIN, OUTPUT);

// a potentiometer that drives the brightness of an LED
SmartPin  const pot_pin(POT_PIN, INPUT, analogWrite, analogRead);
SmartPin  led2_pin(LED2_PIN, OUTPUT, analogWrite);

void setup() {
}

void loop() {
    led1_pin = !button_pin;   // we invert the HIGH/LOW button value since the button is active-low
    led2_pin = pot_pin / 4;
}