I then flashed that example and tested out a quick CURL. I double-checked and triple-checked my access token was correct, but for some reason I always get this:
Header: HTTP/1.1 400 Bad Request
"error": “invalid_request”,
“error_description”: “The access token was not found”
Can anyone see what I might be doing incorrectly? Thank you.
curl https://api.spark.io/v1/devices/<<my device name or number>>/servo -d access_token=<<my hex token here>> -d "args=180"
Where <<my device name or number>> is the name or hex ID of your Photon, and <<my hex token here>> is the cut-and-paste token you got out of the build.particle.io web screen.
If you show your own command (best already in your first post), we might not have to guess what’s wrong and could help quicker.
The command @bko has shown should work.
Have you by any chance added the line break symbols (\) from the code comment you linked to? That might be a possible reason.
Okay, so I have an update. I think my original problem was that I was using an online curl sender, I hopped on Ubuntu and did curl the proper way and I started getting a response of connected and “200” which the script says is good.
But the servo doesn’t move. I put “args=” 0, 180, 100, it doesn’t matter, it doesn’t move. I reflashed Tinker to make sure the thing works. When I put A0 to high or low, the servo bumps a tiny bit forward. I have to do it about 20 times to get a few degrees. So I think the servo works, but I’m not sure. I’m wondering if I should buy another and try it out?
A0 is not one of the pins that has PWM on the Photon. The docs say PWM is available on D0, D1, D2, D3, A4, A5, WKP, RX, and TX. Try one of those, and it should work properly.