Hi
I'm using the Leonardo to print a spacebar.
However, whenever I connect to the computer it takes over and prints an endless bombardment of spaces..
Ironically this occurred whilst trying to create a feature to avoid this.
Is there any sort of hard reset or wipe I can do to solve this?
I've tried using the reset key but it instantly takes over and I can't upload a blank sketch to the correct port.
I'd really appreciate your advice..
I've uploaded the code exactly as is currently on the board (development comments & all).
Thanks
James
int inPin = 3; // pushbutton connected to digital pin 7
int switchpin = A5;
int val = 0; // variable to store the read value
int switchstate = 0;
int counter = 0;
int keys = 0;
#include <Keyboard.h>
void setup()
{
Serial.begin(9600);
pinMode(inPin, INPUT); // sets the digital pin 7 as input
pinMode(switchpin, INPUT);
}
void loop()
{
switchstate=analogRead(switchpin);
val = digitalRead(inPin); // read the input pin
//if (digitalRead(switchpin) == HIGH && counter == 0) {
////keys = 1;
//counter = 1; }
//else if (switchstate == 1 && counter == 1) {
//counter =0; }
Serial.print(" keys: ");
Serial.print(switchstate);
Serial.print(" switchA: ");
Serial.print(val);
Serial.print('\n');
if (val == 1 && switchstate > 300); {
Keyboard.write(32); }
//else if (up == 1){
//Keyboard.write(0xDA);}
//else if (down == 1){
//Keyboard.write(0xD9);}
//else if (right == 1){
//Keyboard.write(0xD7);}
delay(10);
}