MTbutton: Example 2
Event management for Uno, Nano, Mega
Send the letter A on a press button
The program will send the letter A to each press on the wired button wired on A0.
Complete program recommended
This program is completely under interruption, and releases loop which can be used to do something else.
// This program sends the letter 'A' to the series console
#include <MTobjects.h> // V1.0.6 See http://arduino.dansetrad.fr/en/MTobjects
const uint8_t PIN_BUTTON = A0; // Button wired between A0 and GND
void send(void)
{
Serial.print('A'); // Called when you just press the button
}
MTbutton Bouton(PIN_BUTTON, send); // Implementation of the button
void setup()
{
Serial.begin(115200); // Console initialization
}
void loop(){}