hi all - I am a bit of a newbie here and need some help.
I built a Bluetooth page turner for my ipad music notation software (footpedal) using an Adafruit EZ-Key which transmits an up arrow / down arrow keystroke when I push a switch. nice and easy but an accomplishment for me!
Anyway - with the introduction of iOS 8, I can no longer access the iOS keyboard as the ipad sees the EZ-Key as a Bluetooth keyboard... apparently you can add a microcontroller to do this and this is what I need help with.
Questions -
1 - would the trinket do this connected to the EZ-Key?
2 - how would I connect the trinket to the EZ-Key? Wiring wise...
3 - I know that the hex code to do this is '0x7F' - I have never programmed this kind of thing before - could anyone give me some pointers on how to approach this? I'm willing to do a bit of reading to understand this, just need some direction!
Please help! I have posted in another part of the forums and had no responses...
Arduino connection / recommendation?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Arduino connection / recommendation?
I'm not sure I understand the problem. The EZ-Key should be recognized as a keyboard, and the up/down arrow keystrokes should still be recognized by iOS 8. I don't understand why your page turner has broken.
You shouldn't need a Trinket for this. All that is necessary is to program the correct keystrokes into the EZ-Key, as described in the tutorial.
https://learn.adafruit.com/introducing- ... s-wireless
Perhaps you can describe the problem in a little more detail? How did it work originally?
You shouldn't need a Trinket for this. All that is necessary is to program the correct keystrokes into the EZ-Key, as described in the tutorial.
https://learn.adafruit.com/introducing- ... s-wireless
Perhaps you can describe the problem in a little more detail? How did it work originally?
- carlsim
- Posts: 7
- Joined: Thu Jan 22, 2015 9:03 am
Re: Arduino connection / recommendation?
Sorry - the up and down keys for the page turning function is working fine.
I need to get the EZ-key to toggle the iOS keyboard - on a mac keyboard, the eject key does this... the EZ-key won't map to this keystroke.
This is why I think I need a trinket...
I need to get the EZ-key to toggle the iOS keyboard - on a mac keyboard, the eject key does this... the EZ-key won't map to this keystroke.
This is why I think I need a trinket...
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Arduino connection / recommendation?
I see. Yes, you can send the 0x7F ascii character with a Trinket. You would connect one of the Trinket output pins to the RX pin on the EZ-Key. Write a sketch for the Trinket using SoftwareSerial to send the ascii character to the EZ-Key.
You would connect your foot switch to another Trinket pin as an input. When you see the switch, send the 0x7F.
We don't have any tutorials for reading a switch with the trinket, but it's identical to reading a switch with Arduino:
https://learn.adafruit.com/adafruit-ard ... tal-inputs
You would connect your foot switch to another Trinket pin as an input. When you see the switch, send the 0x7F.
We don't have any tutorials for reading a switch with the trinket, but it's identical to reading a switch with Arduino:
https://learn.adafruit.com/adafruit-ard ... tal-inputs
- carlsim
- Posts: 7
- Joined: Thu Jan 22, 2015 9:03 am
Re: Arduino connection / recommendation?
Top notch! Thanks for the reply - can I clarify a few things before I put this into practice?
Again apologies for my newbie status on this...
I checked on the trinket page - GPIO#2 (analogue input pin) connects to the switch so when pulled to ground, makes the circuit.
Program the trinket to send the ascii keystroke, then connect GPIO#0 (pwm output pin) to the RX connection on the EZ-Key. That should be everything needed?
I already have a battery pack in the pedal powering the EZ-Key - could they share the same power source? It has 4 AA (1.5V each) batteries installed... the batteries do seem to last for ages with the EZ-key, but I wanted to make sure there was enough power here...
Also - could you give me some idea how to approach the programming side of things? The hex code just needs to be a single keystroke, not a continuous one, so when the switch is pressed, the keystroke is sent. I know this should be pretty easy but I am a newb and this programming part looks pretty daunting!
Thanks for all your help - it is much appreciated!
Again apologies for my newbie status on this...
I checked on the trinket page - GPIO#2 (analogue input pin) connects to the switch so when pulled to ground, makes the circuit.
Program the trinket to send the ascii keystroke, then connect GPIO#0 (pwm output pin) to the RX connection on the EZ-Key. That should be everything needed?
I already have a battery pack in the pedal powering the EZ-Key - could they share the same power source? It has 4 AA (1.5V each) batteries installed... the batteries do seem to last for ages with the EZ-key, but I wanted to make sure there was enough power here...
Also - could you give me some idea how to approach the programming side of things? The hex code just needs to be a single keystroke, not a continuous one, so when the switch is pressed, the keystroke is sent. I know this should be pretty easy but I am a newb and this programming part looks pretty daunting!
Thanks for all your help - it is much appreciated!
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Arduino connection / recommendation?
Yescarlsim wrote:I checked on the trinket page - GPIO#2 (analogue input pin) connects to the switch so when pulled to ground, makes the circuit.
Program the trinket to send the ascii keystroke, then connect GPIO#0 (pwm output pin) to the RX connection on the EZ-Key. That should be everything needed?
That should be finecarlsim wrote:I already have a battery pack in the pedal powering the EZ-Key - could they share the same power source? It has 4 AA (1.5V each) batteries installed... the batteries do seem to last for ages with the EZ-key, but I wanted to make sure there was enough power here...
This should get you started. I haven't tested it, but it ought to be pretty close:carlsim wrote:Also - could you give me some idea how to approach the programming side of things? The hex code just needs to be a single keystroke, not a continuous one, so when the switch is pressed, the keystroke is sent. I know this should be pretty easy but I am a newb and this programming part looks pretty daunting!
Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial serial = SoftwareSerial(1,0); //tx on pin 0 to EZ-Key
#define SWITCH_PIN 2
bool switch_pressed = false;
void setup()
{
serial.begin(9600);
pinMode(SWITCH_PIN, INPUT);
}
void loop()
{
if (!switch_pressed) //if we haven't already responded to a switch press
{
if (LOW == debounceRead(SWITCH_PIN)) //if the switch is pressed
{
switch_pressed = true; //flag that we've responded to it
serial.write(0x7f); //send keystroke
}
}
else //we've already responded to a switch press
{
if (HIGH == debounceRead(SWITCH_PIN)) //if the switch is released
{
switch_pressed = false; //reset
}
}
}
//debounce the switch
uint8_t debounceRead(int pin)
{
uint8_t pinState = digitalRead(pin);
uint32_t timeout = millis();
while (millis() < timeout+10)
{
if (digitalRead(pin) != pinState)
{
pinState = digitalRead(pin);
timeout = millis();
}
}
return pinState;
}
- carlsim
- Posts: 7
- Joined: Thu Jan 22, 2015 9:03 am
Re: Arduino connection / recommendation?
Hi Rick,
works superbly thanks! One minor adjustment to the code (I had one of the IT programmers at work look at it and tinker) and it works exactly as it should.
Thanks for all your help.
Carl
works superbly thanks! One minor adjustment to the code (I had one of the IT programmers at work look at it and tinker) and it works exactly as it should.
Thanks for all your help.
Carl
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Arduino connection / recommendation?
You're welcome!
Please be positive and constructive with your questions and comments.