Hello.
I want to make my Arduino Due to take charge of my macintosh and thus was running some code.
The code gets compiled and uploaded but no result is found at all.
My code :
#include "Keyboard.h"
char ctrlKey = KEY_LEFT_GUI;
void setup() {
// put your setup code here, to run once:
Keyboard.begin();
Keyboard.press(ctrlKey);
Keyboard.press(32);
delay(1000);
Keyboard.releaseAll();
Keyboard.end();
}
void loop() {
// put your main code here, to run repeatedly:
}
I Remove and attach my due again by it's not effective at all.
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.
Please do not cross-post. Other thread removed.
vidit0210:
Hello.
I want to make my Arduino Due to take charge of my macintosh and thus was running some code.
The code gets compiled and uploaded but no result is found at all.
My code :
#include "Keyboard.h"
char ctrlKey = KEY_LEFT_GUI;
void setup() {
// put your setup code here, to run once:
Keyboard.begin();
Keyboard.press(ctrlKey);
Keyboard.press(32);
delay(1000);
Keyboard.releaseAll();
Keyboard.end();
}
void loop() {
// put your main code here, to run repeatedly:
}
I Remove and attach my due again by it's not effective at all.
Moderator edit:
<mark>```</mark>
<mark>[code]</mark>
<mark>```</mark>
<mark>```</mark>
<mark>[/code]</mark>
<mark>```</mark>
tags added.
Hello vidit0210,
Question: Have you tried test examples like Keyboard Message?
https://www.arduino.cc/en/Tutorial/KeyboardMessage
To save, time, you can get rid of the button code and print in a text editor. The idea is to determine that your Due is well set. Regards,
-p
Sir,
I did code gets uploaded but when I open TextEdit Nothing happens .
The example of Blink Program runs successfully .
Here is the Code which you asked me to try.
#include "Keyboard.h"
//const int buttonPin = 4; // input pin for pushbutton
//int previousButtonState = HIGH; // for checking the state of a pushButton
//int counter = 0; // button push counter
void setup() {
// make the pushButton pin an input:
//pinMode(buttonPin, INPUT);
// initialize control over the keyboard:
Keyboard.begin();
}
void loop() {
// read the pushbutton:
//int buttonState = digitalRead(buttonPin);
// if the button state has changed,
//if ((buttonState != previousButtonState)
// and it's currently pressed:
// && (buttonState == HIGH)) {
// increment the button counter
//counter++;
// type out a message
Keyboard.print("You pressed the button ");
//Keyboard.print(counter);
Keyboard.println(" times.");
//}
// save the current button state for comparison next time:
//previousButtonState = buttonState;
}
I pluuged and re-plugged in Stil no effect
vidit0210,
How are you connecting Due with the PC? are you using the USB programming port?
If your answer is yes, you doing a wrong connection.
Arduino Due is different from Leonardo. To make the keyboard message example work with your Due, you must use a USB OTG cable connected between the Due Native port and your PC.
DON'T try to use a standard USB cable. That will reset your PC.
-p