Pages: [1]   Go Down
Author Topic: What data type to use?  (Read 3527 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

https://github.com/arduino/Arduino/blob/master/build/shared/examples/10.StarterKit/p08_DigitalHourglass/p08_DigitalHourglass.ino#L31
Why is the interval between each LED turning on not a constant?

https://github.com/arduino/Arduino/blob/master/build/shared/examples/10.StarterKit/p13_TouchSensorLamp/p13_TouchSensorLamp.ino#L36
Why is the threshold at which the lamp will turn on not a constant?

https://github.com/arduino/Arduino/blob/master/build/shared/examples/10.StarterKit/p13_TouchSensorLamp/p13_TouchSensorLamp.ino#L51
Why is the variable to hold the sensor’s value of type long?
« Last Edit: June 14, 2014, 09:35:42 pm by Dansercoer » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8913
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The examples used in documentation is not peer-reviewed and is often subject to mistakes and sloppy programming.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Since changing the data types does not change the circuits’ reaction, could I conclude that these fall under ‘sloppy programming’?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8913
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Since changing the data types does not change the circuits’ reaction, could I conclude that these fall under ‘sloppy programming’?

Probably.  Remember that Arduino was designed for artists, not for programmers.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: