void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
Arduino is a cheap, easy-entry system into the world of achieving Exactly What You Need.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
https://123d.circuits.io/lab
essex2visuvesi - Simulator love it!
C-3PO
- Stepper motor control
- Servo - movement sequence of 1 or more servos e.g gun turret, gun recoil, Missile tracker - control of 2 servos working together
Nothing I plan to sail will ever sit on its stern and throw up an impressive wave, so it does not need millisecond perfect control :-)
PS not done much googling yet so maybe there are toms of videos out there {-)
int receiverPin = 9; // connect receiver channel signal to pin 9 on Arduino
unsigned long duration; // create the variable to store the length of our PWM signal in microseconds
void setup()
{
pinMode(receiverPin, INPUT); // configure Ardunio pin referred to by our variable "receiverPin" in this case pin 9 to be INPUT
Serial.begin(9600); // start the serial link so we can view details (print) in the Serial Monitor
}
void loop(){
duration = pulseIn(receiverPin, HIGH); // read PWM signal from the receiver pin we defined earlier (receiverPin) and assign PWM value in microseconds to variable "duration"
Serial.println(duration); // print duration value to serial monitor
} // end of loop
That would save having lots of channels. You could even slave the turrets to a director! Imagine having miniature model Phalanxes tracking passers by!
What are the laws regarding radar transmission? Are there any??
int receiverPin = 9; // connect receiver channel to pin 9 on Arduino
unsigned long duration; // create the variable to store the length of our PWM signal in microseconds
// >>>>> Start of setup configuration
void setup()
{
pinMode(receiverPin, INPUT); // configure Ardunio pin to be INPUT
Serial.begin(9600); // start the serial link so we can view details (print) in the Serial Monitor
}
// <<<<< End of setup configuration
void loop(){
duration = pulseIn(receiverPin, HIGH); // read PWM signal from the receiver pin and assign PWM value in microseconds to variable "duration"
Serial.println(duration); // print duration value to serial monitor
} // end of loop
The idea of turning off the power is about saving current and also fixing the relative positions with NO juddering.Hi John
I currently use that in my submarine anyway as I found the hydro servo, which runs through the Arduino judders during boot up. So I have a relay to keep the power off the servo and the first thing the Arduino does is turn on the power to the servo
So, I am about to start to write the code and if anyone wants to help, you are very welcome!
From memory (which is always dangerous!) the pwm line goes high low high as the Arduino boots. Adding the pull down resistor makes the pwm pin stops this. This also applies to barriew and his misbehaving servo on bootup
C-3PO
I wasted the last 3 evenings just sodding about with mine, seeing what I could make it do :embarrassed:
Yes - I've not had much success with the stepper. Not that I'm too worried as I can't at the moment see a use for it. %)
Barrie
What I am finding is that arduinoing (my new word for it) is a consumer of free time of the worst order {-)
Hi,
Firstly I know little about computers and even less about Arduino.
If there is something I need to find out I will ask those better informed than I.
On a model ship I need music, shouted commands and various gun fire sounds.
Space and battery power are no problem as I use batteries for ballast.
I need a timer so that after an interval the various sounds can play one after the other but with a gap between them of a few minutes.
Would this be in the realms of Arduino or do I need to find another option.
Regards
E2V - I'm not sure about current draw - I guess if the Arduino can measure it, displaying it would be no problem. C-3PO or someone more experienced with Arduino would know. I can send you the code, but there are no schematics! I have been struggling to draw them myself. I didn't include a picture of the inside of the case because it is not a pretty sight %) %)
I'll let you have the code when I get back - I could probably post it here if anyone else is interested.
Barrie
Hi there. I have no idea about the jitter. I have loaded them with capacitors but to no avail. I finally got the idea to power them up through a relay as soon as the arduino boots up. That way there are no issues at all. I am now thinking of extending this with the extend / retract servo. Playing as we speak.
Most of what I do is achieved by copying, shifting and then trying to think with a clear head. It is logic after all! Red helps though.
Cheers
Barrie,
Pleased it all works - for anybody that doesn't know (and is interested) the issue with pin 13 - when the Arduino Uno powers up or is reset - it flashes an LED on the board which is attached to pin 13 to let you know that the board has got power and has booted - anything connected to pin 13 will get that on/off boot-up signal which may well be undesirable!!
Regards
Jonathan
GPS has become the world's principal supplier of accurate time. It is used extensively both as a source of time and as a means of transferring time from one location to another. There are three kinds of time available from GPS: GPS time, UTC as estimated and produced by the United States Naval Observatory, and the times from each free-running GPS satellite's atomic clock. The Master Control Station (MCS) at Falcon Air Force Base near Colorado Springs, Colorado gathers the GPS satellites' data from five monitor stations around the globe. A Kalman filter software program estimates the time error, frequency error, frequency drift and Keplerian orbit parameters for each of the satellites and its operating clock. This information is uploaded to each satellite so that it can be broadcasted in real time. This process provides GPS time consistency across the constellation to within a small number of nanoseconds and accurate position determination of the satellites to within a few meters.
Telemetry - one step closer to autonomous navigation
At last some success. If you have ever played around with technology/programming you will completely understand the experience of hitting a brick wall that just doesn't want to budge and your project grinds to a halt. Well after several precious hours of nothing I have at last got telemetry data flowing over the airwaves (433mhz) and now appearing on a remote shore based PC screen. It's rough (very) and needs thought but the basic concept is shown below - lucky it was only days before it hit the scrap heap...
i know exactly how you feel: https://www.youtube.com/watch?v=fuX2pPjoMCY
Hi Tim,
Looks like you got your solution working - what was the display screen you where using?
Jonathan
Hello Brian,
The funny thing about this is that most of the code I am using is not mine and is copied/patched together from the internet as most things with Arduino you copy and amend rather than start from scratch.
I am watching your progress with your dynamic positioning project - if you think the telemetry would be of use as you get further into your project ( so you can see on shore what is happening with sensor/gps data) then very happy to share code. (this doesn't sound quite right as it's not really my code in the first place!) - cost for the Telemetry transceivers (2x£8)
Like most things if you get a glance under the bonnet you will see that it's actually very simple and logical - easy for me to say now having wasted about 10 hours watching a blank telemetry less screen as I plugged away trying to get if to fire...
The application running on the shore based PC is written in VB.net using a free version of Microsoft Visual Studio. Whilst I can program in this with some effort 95% of the code was pasted from the internet. This could equally be an LCD screen attached directly to an Arduino. The reason I have gone for a pc based app is I want to do live Google mapping and like the idea of an animated compass and may even add a Radar section as well.
Regards
Jonathan
...poach around and patch up code to see me through %) :} :}
as to your browser being out of date.... isn't the map view "browser" just the "real" browser being used as an "object" embedded in your GUI? i would hope that VB.net would have no bearing on thatre browser I think it's an active X control - anyway it doesn't want to work in VS VB.net 2012 - now moved to 2015 and all working fine so I guess I will never know the answer.
radio and an OpenLRSng system could co-habitate- I would think that it would be a simple case of the strongest signal wins.
Want to know more about Arduino and how it can be used in radio control models
Have a look here for some ideas, inspiration, information - http://rchub.co.uk/ (http://rchub.co.uk/)
A collection of articles, web links, tutorials, concepts......
Regards
C-3PO