Go Down

Topic: Apprentice coder (Read 5 times) previous topic - next topic

Pedro147

#65
Nov 03, 2012, 02:04 am Last Edit: Nov 03, 2012, 02:14 am by Pedro147 Reason: 1
Sorry I thought that my question was clear but obviously it was not.I will use the question marks so that no one thinks that I am stating a fact, only asking if I am correct.

What does "void flashLED(uint8_t pin, int repeat)" mean.

Void means - returns no value ?
flashLED - is the name of the function ?
uint8_t and int - are data types ?

In the for loop what does "repeat * 2" - * is a multiplier but that's all I understand here.

Thank you for your patience and did it seem like I understood your explanation re the setLED function.

EDIT - I just saw your edit so I will have to think about that too (and I thought that I was confused before  8) )

lloyddean

Your understanding of what the function does seems correct while your understanding of how to declare and or call functions needs work.  None of that is meant to imply any kind of insult.

Since I'm not into writing long replies (and it's not that I don't think you're not worth the effort) I'll send you off to <http://www.cplusplus.com/doc/tutorial/functions/> for an explanation.

Please keep asking concerning things you don't understand.

Pedro147

Thanks for your patience and the link to hopefully further understanding You are a good teacher and if I could give you an apple I would ( my Aussie sense of humour - we are a strange bunch down here)  :smiley-red:

lloyddean

#68
Nov 03, 2012, 02:26 am Last Edit: Nov 03, 2012, 02:39 am by lloyddean Reason: 1


What does "void flashLED(uint8_t pin, int repeat)" mean.

Void means - returns no value ?
flashLED - is the name of the function ?
uint8_t and int - are data types ?



Code: [Select]

void flashLED(uint8_t pin, int flash_count)


This is the beginnings of the actual definition of a subroutine, much like 'digitalRead' or 'delay'.

The function returns a 'void', void meaning nothing is returned from the function.

The name of the function is 'flashLED' and needs two parameters passed to it.

The first parameter has a suggestive name of 'pin' and the second parameter a suggestive name of 'flash_count'. 'pin' specifies which pin the LED is connected to while the 'flash_count' communicates how many times the LED on 'pin' is to be toggled 'ON' and 'OFF'.

EDITED:

retrolefty




What does "void flashLED(uint8_t pin, int repeat)" mean.

Void means - returns no value ?
flashLED - is the name of the function ?
uint8_t and int - are data types ?



Code: [Select]

void flashLED(uint8_t pin, int flash_count)


This is the beginnings of the actual definition of a subroutine, much like 'digitalRead' or 'delay'.

The function returns a 'void', void meaning nothing is returned from the function.

The name of the function is 'flashLED' and needs two parameters passed to it, both of which are of type 'int' which are 16 bit signed values.

Actually one parameter of type uint8_t and the second a type int.

The first parameter has a suggestive name of 'pin' and the second parameter a suggestive name of 'flash_count'. 'pin' specifies which pin the LED is connected to while the 'flash_count' communicates how many times the LED on 'pin' is to be toggled 'ON' and 'OFF'.

Not really 'suggestive names', but rather the actual names of the variables the function will use to utilize the values passed to them within the functions coding statements.



Go Up