Hey,
I am very new to Arduino and programming microcontrollers in general. I was hoping to get insight into a problem I recently had with the USB HID library. I loaded up the example provided which was:
#include "PluggableUSBHID.h"
#include "USBKeyboard.h"
USBKeyboard Keyboard;
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
delay(1000);
Keyboard.printf("Hello world\n\r");
}
This worked just fine, but I only wanted it to write out the string once so I modified it so it was this.
#include "PluggableUSBHID.h"
#include "USBKeyboard.h"
USBKeyboard Keyboard;
void setup() {
Keyboard.printf("Hello world\n\r");
}
void loop() {
// put your main code here, to run repeatedly:
}
The setup meant it should only run once, but the string wasn't written at all. Also, if I changed it so that I had a variable in the loop that only allowed the prinf() statement to run once, it also did not write it out.
I have tried a variety of different ways around, and none seemed to have worked. Could anyone help me with running the Keyboard.printf() only once?
Thanks in advance.