Hi, I am trying to control the ATmega32u4 in Yun from a Python script running in the same Yun (AR9331) .
I am using the REST approach to achieve this, and wrote a simple sketch for ATmega32u4 to accept REST commands using the "Examples > Bridge > Bridge" sketch as a template.
It works ok as long as I send the commands using a browser from an external device (computer) like the following:
http://192.168.0.250/arduino/servo/70In which case the servo moves to the specified position.
But if I issue the commands from inside the Linux-side of the Arduino nothing happens. I have tried using Linux terminal commands like:
curl localhost/arduino/servo/20
curl localhost:5555/arduino/servo/20
curl -o a.txt http://localhost:5555/arduino/servo/20
wget -p http://localhost:5555/arduino/servo/20
wget -p http://localhost/arduino/servo/20
Some commands show an "Error 401", others show no error, but in either case the servo doesn't move.
Also inside Arduino I wrote a small python script:
import urllib2
urllib2.urlopen("http://localhost/arduino/servo/20").read()
Which also gives an "Error 401".
I haven't found a single example in the internet of using the REST approach from inside Arduino Terminal in several hours of searching. Every-time the examples show the case of using REST from an external browser.
Can anyone point me to a solution for being able to control the ATmega32u4 of YUN from a Python script running inside Yun?
Thanks.