14 lines
491 B
C++
14 lines
491 B
C++
//==========================================================
|
|
// JOYSTIC
|
|
//==========================================================
|
|
|
|
// Helper function
|
|
float average(uint16_t pin, unsigned int times) { // Changed to uint16_t
|
|
unsigned long readings = 0;
|
|
for(int i=0; i<times; i++) readings += analogRead(pin);
|
|
return readings / times;
|
|
}
|
|
|
|
//==========================================================
|
|
// JOYSTIC
|
|
//==========================================================
|