Whats this thing?
So if I understand correctly when the code is in print(measureVal), it executes the void print loop and inside that loop float result is the same as measureVal, because of : print(measureVal);
But the thing I don't understand is what is the float readTemp(int pin) {... } Like it's not a loop, it looks like a variable. How can it not be inside a loop. And what the actual freaking donut does this thing do?
thanks
void setup() {
Serial.begin(9600);
}
void loop() {
float measureVal=readTemp(A0);
print(measureVal);
delay(1000);
}
float readTemp(int pin) {
int reading=analogRead(pin);
float voltage=(5.reading)/1023.;
float temperature=(voltage-0.5)100;
return temperature;
}
void print(float result) {
Serial.print("Temp: ");
Serial.println(result);
}
1 Reply
that is a equation or is it
I have had some breaks
so
who knows
12!
the variable is 12 idk
yes
looop
damn
that is a void without a name
im not the bigtest bulb
oh
x
no idea
the function does not return a value
oh so that what you meant
nothing?
does it return x? hmm
but where
the x will be never seen again
write it outside the loop
xd
oh sorry forgot
sure
i can throw good
sometimes that happens tes
yes*
The ball would just fly out there
not return
TWO people
take out the void?
some variable i guess
variable type
indicator
pleaes
INT
inr theStudier() {
int x = 2 + 10;
return(x);
}
?
so float measure val =readTeamp(A0). and then float readTemp(int pin) does stuff to and return the value
floating value, pretty easy to toss as its already floating
int theStudier(someting here?)
void theStudier(int sausage, int IhaveToRun) {
int x = sausage, IhaveToRun;
return(x);
}
?
+ not ,
but should i change the void
int theStudier(int sausage, int IhaveToRun) {
int x = sausage,+IhaveToRun;
return(x);
}
no
I have time
const int but=3;
void setup() {
Serial.begin(9600);
pinMode(but,INPUT_PULLUP);
}
void loop() {
int answer=theStudier(3,4);
print(answer);
delay(1000);
}
int theStudier(int sausage, int IhaveToRun) {
int x = sausage+IhaveToRun;
return(x);
}
void print(int something) {
Serial.print("Temp: ");
Serial.println(something);
}
So it prints 7
I think , because it prints 7
yes
thats what i thought too, but the material said otherwise
but that makse more sense
is it a functions with a return value
okay thank you so much, imma hit the sack