Hi everyone, I need to create a code that will stock and receive information from a strenght sensor. But, the problem is that I have no idea how to do it. Moreover, i have to send those informations to a servomotor so it can move.
If someone can give me a hint or anything to help me on that (because am a noob), thanks a lot
Simple servo test code you can use to experiment with your servo.
// zoomkat 7-30-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// Powering a servo from the arduino usually *DOES NOT WORK*.
String readString;
#include <Servo.h>
Servo myservo;Â // create servo object to control a servo
void setup() {
 Serial.begin(9600);
 myservo.attach(9);
}
void loop() {
 while (Serial.available()) {
  if (Serial.available() >0) {
   char c = Serial.read(); //gets one byte from serial buffer
   readString += c; //makes the string readString
   delay(3);
  }
 }
 if (readString.length() >0) {
  Serial.println(readString);
  int n = readString.toInt();
  Serial.println(n);
  myservo.writeMicroseconds(n);
  //myservo.write(n);
  readString="";
 }
}