Very new to Arduino/coding in general and am seemingly trying to do one simple thing for automation:
Send the letter 'U' from my mac to the Arduino via serial/USB port via keyboard shortcut. Coding the Arduino was easy and sending the 'U' via the Arduino serial monitor works like a breeze, but i've no idea how I can automate this via the mac. As far as I can tell my only avenue is the Terminal which nothing seems to work very well. Any ideas?
Basically the way my code works is that when I type the letter 'U' into the serial monitor it executes code on the Arduino to turn on a red led (very basic). However, I want to be able to execute sending the 'U' character via a keyboard shortcut on my mac without needing to use the Arduino serial monitor at all. I've just no idea how I can do that. I've been reading that it is doable via the terminal.app, but I want to automate this
Tricky. You would need to write a program in your language of choice for Mac and figure out how to create a global keyboard hook. Google wasn't particularly helpful for that.
Then it's easier - just send a U out of the right serial port.
You may want to find a different way to do it, at least initially.
Well, I can hook the keyboard shortcut up myself later (problem for another day), but at the moment i'm just trying to send the 'U' to the Arduino somehow with a 'single click' so to speak. Something like an Applescript or a single Terminal command would be ideal, but nothing out there seems to have this functionality.
You have a C compiler available to you. The Arduino IDE uses gcc and I expect the Mac provides one too, so you can write a tiny program that sends the U out and invoke it from terminal.
Be aware that the port the Arduino is connected to varies, at least on Windows. I haven't had a problem with my Mac once i figure out where it is, but YMMV.
still very new to coding, so writing a tiny program seems daunting at the moment - but at least I have an avenue to explore now instead of being totally lost. Thanks for the suggestion. I also read a shell script might work, wondering if this might be easier?