Journal 2017/04/25


My previous problem of not being able to upload the code was solved when the drivers for the nanoboard were installed.

This allowed me to successfully upload the code to the nanoboard.


Now that Ive uploaded the code to the nanoboard I need to wait for the wires to come in, in order to solder them to the keyswitches

I used this code as a test.

#include <Bounce2.h>

#define led1 2 //led 1
#define led1n 3 //negative so wiring can be neat
#define led2 5 //led 2
#define led2n 4 //negative
#define ledL 13 //led L is on pin 13 on a uno
#define key1 6 //button pin 1
#define key2 7 //button pin 2
#define key1v 29// Letter Z, values from
#define key2v 27// Letter X, v for value
//Alternate keys:
//#define key1v 6// Letter C
//#define key2v 25// Letter V

boolean state1 = true;   //if button1 has not been pushed
boolean state2 = true;   //if button2 has not been pushed

//creating bounce objects
Bounce debouncer1 = Bounce();
Bounce debouncer2 = Bounce();

void setup()

//So you don’t need a resistor
pinMode(key1, INPUT_PULLUP);
pinMode(key2, INPUT_PULLUP);

//attaching the buttons to the bouncer

//time in Msec to wait to remove bounces, 3-8 Msec is good

pinMode(led1, OUTPUT);
pinMode(led1n, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led2n, OUTPUT);
pinMode(ledL, OUTPUT); //LED L onboard

digitalWrite(led1n, LOW);//ground
digitalWrite(led2n, LOW);
digitalWrite(ledL, LOW);

void loop() {
//check button push state

if ( == LOW & state1) { // Send keypress
buf[2] = key1v;//starts from array 2
Serial.write(buf, 8);
digitalWrite(led1, HIGH);
state1 = false;
if ( == HIGH & !state1) { // Release key
buf[2] = 0;
Serial.write(buf, 8);
digitalWrite(led1, LOW);
state1 = true;

if ( == LOW & state2) { // Send keypress
buf[3] = key2v;
Serial.write(buf, 8);
digitalWrite(led2, HIGH);
state2 = false;
if ( == HIGH & !state2) { // Release key
buf[3] = 0;
Serial.write(buf, 8);
digitalWrite(led2, LOW);
state2 = true;


I will end up editing it in order to better fit my keypad


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s