Mozzi  version v2.0
sound synthesis library for Arduino
CapPoll< SENSOR_PIN, SEND_PIN > Class Template Reference

A class for reading voltage on a digital pin, derived from http://arduino.cc/en/Tutorial/RCtime. More...

#include <CapPoll.h>

Detailed Description

template<unsigned char SENSOR_PIN, unsigned char SEND_PIN>
class CapPoll< SENSOR_PIN, SEND_PIN >

A class for reading voltage on a digital pin, derived from http://arduino.cc/en/Tutorial/RCtime.

This is designed to be used in updateControl(). Each time it is called, it checks if a capacitor has charged, and returns an output reflecting how long it took for the most recent charge.

Definition at line 23 of file CapPoll.h.

Public Member Functions

 CapPoll ()
 Constructor.
 
unsigned int next ()
 Checks whether the capacitor has charged, and returns how long it took for the most recent charge. More...
 

Member Function Documentation

◆ next()

template<unsigned char SENSOR_PIN, unsigned char SEND_PIN>
unsigned int CapPoll< SENSOR_PIN, SEND_PIN >::next ( )
inline

Checks whether the capacitor has charged, and returns how long it took for the most recent charge.

This would preferably be called in updateControl(), but if the resolution isn't fine enough or the pin charges too fast for updateControl() to catch, try it in updateAudio().

Returns
the sensor value, reflected in how many checking cycles it took to charge the capacitor.

Definition at line 40 of file CapPoll.h.