Hello Sparkfun forum,
Had this working using an Arduino Uno but since the Kite Messenger goes up a kite string to deliver a payload, size and weight are minimized by going to a smaller board, the Pro Mini.
The sketch was loaded onto the Pro mini with this setup.
The sketch is copied herewith below.
The receiver/ProMini/servo is connected according to
Test method
- Apply 5 volts DC
1.1 Red LED comes on and stays on.
1.2 Green LED comes on dimly, then, after two seconds goes to the same brightness as the red LED.
1.3 LED at Pro Mini comes on
- Press on button at transmitter fob.
2.1 LED at fob comes on.
2.2 LED at receiver comes on
- Release on button on fob.
3.1 LED at fob goes out.
3.2 LED at receiver goes out.
Expected result: Press on button at fob and server arm moves 90 degrees.
Actual result: Press on button at fob and server arm does not move 90 degrees.
Seems like it should work with the Pro Mini if it works with the Uno.
Thanks.
Allen in Dallas
+++++ Kite Messenger Code +++++++++++++
/* Get information from rf receiver
and rotate motor to 90 degress
Freelancer
11 - 05 - 2021
*/
#include <Servo.h>
#define greenLed 9
#define redLed 10
#define servoPin 11
#define triggerPin A0
Servo servoMotor; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
int onState, offState = 0;
void setup() {
servoMotor.attach(servoPin); // attaches the servo on pin 9 to the servo object
pinMode(triggerPin, INPUT_PULLUP);
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
}
void loop() {
int triggerValue = digitalRead(triggerPin);
if (triggerValue == HIGH && onState == 0)
{
digitalWrite(redLed, HIGH);//Red Led ON
digitalWrite(greenLed, LOW);//Green Led OFF
for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 90 degrees
// in steps of 1 degree
servoMotor.write(pos);
delay(15);
}
onState = 1;
offState = 0;
}
////////////////
if (triggerValue == LOW && offState == 0)
{
digitalWrite(redLed, LOW);//Red Led ON
digitalWrite(greenLed, HIGH);//Green Led OFF
for (pos = 90; pos >= 0; pos -= 1) { // goes from 90 degrees to 0 degrees
servoMotor.write(pos);
delay(15);
}
offState = 1;
onState = 0;
}
}