I am trying to print "echo \"-----BEGIN CERTIFICATE-----\" >> text.txt" using Arduino viva the `keyboard.print();` function the " turn to @

77 views Asked by At

I am trying to use the keyboard function to print a string out through the keyboard in this case I am trying to print the below statement.

CODE
____
Keyboard.begin()
Keyboard.print("echo \"-----BEGIN CERTIFICATE-----\" >> text.txt"); //--> Arduino  
delay(200)
Keyboard.print(KEY_RETURN);
Keyboard.end();

output
______
echo @-----END CERTIFICATE-----@ >> text.txt

Desired output
______________

echo "-----BEGIN CERTIFICATE-----" >> text.txt 

Can any one help me with this!!! below is the sample code

 
#include <Keyboard.h>
void setup() 
{
    Keyboard.begin();
    delay(5000);
// Minimize all windows
    Keyboard.press(KEY_LEFT_GUI);
    Keyboard.press('d');
    Keyboard.releaseAll();
    delay(50);
// run task
    Keyboard.press(KEY_LEFT_GUI);
    Keyboard.press('r');
    Keyboard.releaseAll();
    delay(100);
    Keyboard.print("PowerShell -NoLogo");
    delay(100);
    Keyboard.write(KEY_RETURN);
    delay(100);
//-------------------- the above code works fine ---------------------

// save file 
    Keyboard.print("echo \"-----BEGIN CERTIFICATE-----\" >> text.txt");//---> this line
    delay(50);
    Keyboard.write(KEY_RETURN);
    delay(500);
    Keyboard.end();
}
1

There are 1 answers

0
Piglet On

Arduino's keyboard library uses the US layout. So if you send double quote which in your keyboard layout is shift + 2 this results in a @ which would be the output of the US layout.

I don't know which layout you're using so I cannot tell you what character to send instead.

Alternatively use keyboard.write("\"");