Author Topic: digispark pro as USB keyboard  (Read 37 times)

yo2ldk

  • Newbie
  • *
  • Posts: 6
digispark pro as USB keyboard
« on: August 11, 2017, 11:19:10 am »
Hi,

 I need to setup the Pro as keyboard,
with the following code, digispark simple work well, but with pro, it says USB not recognized, where is the mistake?
both are compiling without errors:

Code: [Select]
#include "DigiKeyboard.h"

uint8_t button1 = 0;
uint8_t button2 = 2;
uint8_t value1 = LOW;
uint8_t value2 = LOW;

void setup() {
 
 pinMode(button1, INPUT);
 pinMode(button2, INPUT);
}

void loop() {
 
  value1 = digitalRead(button1);
  value2 = digitalRead(button2);

  if(value1 == HIGH) {
    DigiKeyboard.sendKeyPress(6);
    DigiKeyboard.sendKeyPress(0,0);
   
  }

  if (value2 == HIGH) {
    DigiKeyboard.sendKeyPress(4);
    DigiKeyboard.sendKeyPress(0,0);
  }
 
 DigiKeyboard.delay(500);
   }