Sending text via Screen in Terminal OSX - macos

I have connected an Arduino to a MacBookPro using USB, by using Screen (serial) in Terminal on the MBP. I cannot figure out how to send text, via Screen, from the MBP to the Arduino. Can anyone kindly point me in the right direction?

I didn't see anything helpful in a very quick read of the 'screen' manual page. So, I'd be tempted to use the old 'cu' command. Something like this might work to connect to the Arduino:
cu -l /dev/cu.usbmodem0000001 -s 38400
(use whatever cu device your Arduino has, and pick whatever speed you want), then do:
~> filename
to send the named file to the Arduino. When you're done, a "~." will end the session.
Check the man page for the 'cu' command - you can receive files, too, and run commands with their output sent to the serial line.
Have fun!

Related

Can't connect to D1 Mini with Micropython after running a program

I'm using D1 Mini with micropython
It happens a lot that I upload some code that has a main loop in it, and afterwards I lose connection to the board
I can see the console output, but can't see the files, can't burn a new firmware, can't stop the code from running, anything...
If I press ctrl+c or ctrl+d it holds for a second, then continues
I'm using a raspberry pi and Thonny for the development
Same from esptool and ampy
Tried looking for an answer online, but couldn't find anything relevant
What can I do?
What I do in my apps- I add time.sleep(3) at the beginning of my application. And when I wish to do code upload, I connect to the board, press CTRL+D for soft reset and CTRL+C to kill code. Then do upload required code. This approach works best for me.
Moved from pi to windows, I was able to delete and write the firmware again using esptool
The only thing is that now I have to press the reset button while connecting the USB so the computer will recognize the controller

raspberry pi3 can not launch application on primary HDMI Display, can launch on remote using ssh -x

I had built console core image for raspberry Pi3, and I am able to boot the Rpi3 successfully using SD card.
I have created an electron app which is able to launch on remote display over ssh.
However when I launch the application on Monitor connected through HDMI Cable, It gives following error
Can not open Display :0.0
I have seen many people asking this question for not able to launch on remote display, which works fine in my case.
Can anyone help in this?
With console core, you don't have an X server running to display on.
You can upgrade your system to include the X installation -- search for 'install pixel desktop' -- or you could just refresh the card with the lite or full image.
If you set the Pi to auto login to the pi account, you can start your application on login by adding it to the bottom of .xinitrc. You could also start it from a remote ssh, displaying on the local display, by setting DISPLAY=:0 in the environment before you start. You'll need to explore the world of X Windows authentication to make this work. See the man page for the xhost command, for instance.
(This is an expansion of LetoThe2nd's comment, which probably should have been an answer instead.)
Console core image means that there is no xserver running, and hence no display :0. Try getting started with core-image-x11 maybe, or whatever suits the RasPi.

Getting output of `pmset -g ps` to to trigger an email via Mail.app when output includes "UPS Power"

I've just gotten a UPS and would want notification emails whenever the UPS kicks in. I've connected the UPS via USB so OS X can monitor it via Energy Saver, but there are no other options for notifications.
I've tried installing apcupsd, but am not able to install it due to compatibility issues with OS X 10.11.1
In an effort to find a simple workaround in absence of apcupsd to accomplish this, I am looking at using pmset -g ps to indicate the current power status since it gives an string output indicating status as "AC Power" or "UPS Power"
I want an email to be sent whenever the output of pmset -g ps contains "UPS Power". Not really sure if I need to pipe the output as a file or set it to the clipboard, which then can be read by the terminal in order to trigger an email via Mail.app if it contains that particular string, or if there is a simpler method via Automator to accomplish this.
Thank You!

Wake on lan doesn't wake up the display of OSX Mavericks

I updated to OSX 10.9.5 and realized that one function pipeline that I used flawlessly is now broken.
I send a wake-on-lan magic packet to my OSX from my Raspberry Pi which successfully wakes up the OSX, but unlike before the iMac's display stays dark. Previously the display also brightened up. The problem is not that particularly, but that when I run an applescript through SSH the iMac goes back to sleep by itself in the middle of running and I have to wake it up again to finish the interrupted script. I have setup my energy saving to "Never" so it shouldn't do that.
I even tried running a script that actually sets the brightness of iMac's display to highest, but that doesn't wake up the display either.
Only when I take a VNC connection or move the local USB mouse the display wakes up and OSX won't go back to sleep by itself.
I found a solution for this. Just run this on the remote OSX's terminal:
caffeinate -u -t 1
It will wake up the display immediately. I found the solution from this blog

How to detect when OS X Screen Sharing is active programmatically?

OS X does not make it obvious that you might've left a screen sharing session open -- and it's still actively broadcasting your session to these other computers. Does anyone know where Snow Leopard stores that the computer you're sitting at has an open screen sharing session?
If I could detect this file using a shell script every minute or so, then I could fire a Growl notification to let me know that I'm essentially being watched by this other computer (using the code snippet found here).
Otherwise, the only way to know now is to notice a very small icon on the top right of my screen that looks like binoculars (very hard to notice).
One way would be to use lsof to check for any established connections by AppleVNCServer
lsof -a -i :vnc-server -sTCP:ESTABLISHED -c AppleVNCServer

Resources