## 2016년 12월 1일 목요일

### Moving a Gauge Needle by rotating it to a Position to set a Temperature

Hello, Im having issues trying to scour the webs for an example of how to move a gauge needle sprite to a position within a circular stationary backround sprite. I already know how to tap it into position, but I want the action to FOLLOW the finger movement across the canvass. Any help / examples, AIA links, redirects would be appreciated. I don't need any help mapping the angle to a value as my math is strong, but sliding the needle around seems to be my biggest headache.

Thank You!
BTW, I'm using Android APP Inventor 2

--
NEVER MIND!
I FIGURED IT OUT!

Here's the AIA, APK, All relevant image sprites. That should be all you need to get the idea. There's a part where I add 17 to the lowest number I wish to send over bluetooth, because it was negative 17. You cant handle neg numbers on the buletooth serial com on an arduino. Theres another part where I make comparisons so that if I drag the needle outside of my desired range, it will fall to the min or max value (whichever is closer) on the arduino side, I had to flip the readings around and map them to my desired value range. Arduino code looks like this. I do this for a living, so i appreciate donations, but I'm glad to hand this out to the needy as a freebie. If you wish to donate, then send me an email with (I have a donation for you)  in the subject line. And I'll send you a paypal donate request ENJOY!

#include <softwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX for the HC-06 Bluetooth module TX of one goes to the RX of the other and vice versa

void setup()

Serial.begin(9600);
mySerial.begin(9600);

void loop()

if(mySerial.available > 0){
}
newVal = map (newVal, 160, 0, 75, 180);    // you'll get a declining number as you move the needle to the right, so the mapping needs to be done in reverse.
Serial.println(newVal);

--
you might want to add a screenshot of the relevant blocks and your aia file into this thread
this could help others, who are looking for a solution to a similar problem

Taifun

--
I updated my previous comment. Enjoy.

--