Browse Source

upped digital button example

master
dennisdebel 3 years ago
parent
commit
f62c40bc05
  1. BIN
      digitalButtonExample/01-physical-setup.jpg
  2. 39
      digitalButtonExample/digitalButtonExample.ino

BIN
digitalButtonExample/01-physical-setup.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

39
digitalButtonExample/digitalButtonExample.ino

@ -0,0 +1,39 @@
// Using Arduino as keyboard emulator on iOS devices (HID/Keyboard)
//
// *used Arduino Pro Micro Clone, 5v
// *selected Arduino Leonardo as board when compiling
//
// for use with iOS without complaining, modify the USBCore.h file to tell the arduino to use less usb poiwer
// change USB_CONFIG_POWER from 500 to 100, on line 98, see below
//
// bMaxPower in Configuration Descriptor
// #define USB_CONFIG_POWER_MA(mA) ((mA)/2)
// #ifndef USB_CONFIG_POWER
// #define USB_CONFIG_POWER (100)
// #endif
//
// on mac the USBCore.h is located at:
// /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/USBCore.h
//
// ref: https://arduino.stackexchange.com/questions/60771/arduino-micro-draws-too-much-power-from-iphone-how-can-i-change-that
//
// tested on:
// iPhone 6 + iOS 12.4.4
// iPhone X + iOS 14.2
//
#include <Keyboard.h>
void setup() {
pinMode(3,INPUT_PULLUP);
}
void loop() {
Keyboard.begin();
if(digitalRead(3) == 0)
{
Keyboard.write('A');
delay(100);
}
Keyboard.end();
}
Loading…
Cancel
Save