I am new to the Arduino

Hi, I wonder if anybody might have a clue to what has happened ? I am trying to run a 12 volt vehicular relay off an arduino uno and am using the 13 pin and the ground pins (2) on the power out! I am running the pin 13 through a 330 ohm resistor and an optocoupler to a mini relay and the vehicle relay from this (mini relay) the idea is to programme the vehicle relay to fire (high) at say 4 secs and then (low) off for say 10seconds. I have programmed the arduino with an LED using the ground and 13 pin adjacent on the pin 13 bus and when I connect the relays etc in to the Arduino, the veh relay works (happily clicking on and off) but it only works at the same timing as the standard Uno indicator light speed ie around .5 high and say .5 low? can you please tell me have I blown something or should I re-programme the arduino to read relay instead of Led? and call the new programme something else? if so any advice re any new programme would be very gratefully recieved Thanks in anticipation, Rob, UK junction 9,M25

can you post the code ( highlight it and click on the # button to display it in a panel )

Hi Karma8 I am like many "new to Arduino users" I suspect, and am totally over-awed by its capability and flexibility. I now have it working as I want it to, thankyou so much for your kind offer. What I think happened, is that somehow the Aeduino didn`t recognose (as its own) the port that I usually use for it ie port 5 ( the easiest for me as iuts in the front of my PC) and it automatically thought it should be in 1? and I missed that, so as soon as I changed it to 5 it fired up OK and I managed to reprogramme it.

As I am a novice to the programming, I wonder if I can take you up on your kind offer, (I dont know how to paste the programme as yet to the forum, but will soon find out I guess) I wont waste your time I assure you,

What I am doing with the Arduino is using a single unit to operate a "burst" pump system using a solenoid valve "teed" off a peristaltic high (ish) pressure system and it works fine with a small 555 timer system at present, but I need to be able to change the bursts timing as the system calls for it ie micro secs etc I have as yet to sort the needed Arduino inputs etc and its early days as yet . Thanks again for your kind offer and help KIndest regards Rob.

I am not sure how those two posts relate to the request for your code.

When asking a question it is best to use sentences with full stops at the end at leasrpt.
In case you have run out of them here are some to copy and paste
..................................................

our US members might find ".................................................." an explanation of the "Grumpy" Mike ??? :slight_smile:

(for others , English speakers call them "full stops" )

rduino1:
I have programmed the arduino with an LED using the ground and 13 pin adjacent on the pin 13 bus and when I connect the relays etc in to the Arduino, the veh relay works (happily clicking on and off) but it only works at the same timing as the standard Uno indicator light speed ie around .5 high and say .5 low?

Pin 13 is connected to the onboard LED to the LED will light whenever pin13 is high. If it's blinking at 0.5 seconds high and 05 seconds low then presumably that's what the sketch is telling it to do. Arduinos typically come with a 'blink' sketch preloaded so it is easy to just plug it in and see it do something, but when you want to define your own behaviour you would need to write and upload your own sketch. Have you done that? If so, please post the code.

int ledPin = 13;
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}

.................................................Full Stops (if needed).................................................
The above code seemed to work after the initial problem with the port selection, but now I would seem unable to change the low and high periods? from what I initially set them at, around:- low 10 secs and high 1 "sec" (thats short for seconds, GM) Any Ideas as to what I may be doing wrong? Other than grammatical errors? would be most gratiously recieved. Thanks in anticipation.

digitalWrite(ledPin, HIGH); // switches on the LED
delay(1000); // waits for 1000 milliseconds = 1 second, then :-
digitalWrite(ledPin, LOW); // switches off the LED
delay(1000); // waits for 1000 milliseconds again = 1 second,

rduino1:
The above code seemed to work after the initial problem with the port selection, but now I would seem unable to change the low and high periods? from what I initially set them at, around:- low 10 secs and high 1 "sec" (thats short for seconds, GM) Any Ideas as to what I may be doing wrong? Other than grammatical errors? would be most gratiously recieved. Thanks in anticipation.

So the posted code works, you made modifications to it which you aren't going to show and the new code "doesn't work"? Start by posting the code that doesn't work using the CODE tags, telling us what you are expecting it to do and what it is doing.

Apologies for the confusion.
I split the topic when I thought (wrongly) the second post related to a different topic.
@OP, calling other members by their karma rating is tricky, for karma ratings, unlike stock prices, can only stay the same or go up.

@GM, the M25 is a fractal because, although it bounds a finite area, it take an infinite time to traverse, meaning it must be infinitely long.

@AWOL

I thing junction 9 is the number of one of the parking bays in the M25 car park.

Boffin 1, you are right Junction 9 is almost a car parking space off the M25 motorway :).
I think that I have it sorted now? code wise, however I am not completely sure. What I would like to do is programme the recipient relay to fire more than once, i,e, fire four times in quick succession (say 0050) and then rest for say 8(ooo) secs, but am not sure how to build multiple delays into the programme. The fast talking and very capable US lads in their tutotials ( AKA Mr Blom mainly) leave me behind from the start. Doh! I guess I`m just thick. Is there an existing site where I can copy and paste a similar existing programme and doctor it to suit? thanks for your help so far.

digitalWrite(ledPin, HIGH); // switches on the LED
delay(50); // waits for 50 milliseconds = 0.02second, then :-
digitalWrite(ledPin, LOW); // switches off the LED
delay(50); // waits for 50 milliseconds again = 0.02 second, digitalWrite(ledPin, HIGH); // switches on the LED
delay(8000); // waits for 8000 milliseconds = 8 second, then :-
digitalWrite(ledPin, LOW); // switches off the LED
delay(1000); // waits for 1000 milliseconds again = 1 second,
delay ( 60000 ); // wait 1 minute

and so on

Thanks so much for that "Boffin 1" I am nost grateful! I will copy and paste (deleting the indication statements) and let you know what Happens, thank you so much once again Kind regards Rob.

waits for 50 milliseconds = 0.02second

Novel.

waits for 50 milliseconds = 0.02second

LOL I think I meant to write 1/20th second :slight_smile: