![]() ![]() User Actors and a template file for working with Liminal Entertainment Technologies’ software ZoomOSC. It’s probably still better to be clever about detecting the ring pulses, but that’s for another day.Categories: Application, Tutorial Tags: Control, Example, Serial ZoomOSC User Actors & Template File Woland | 29. I have no idea if it will work but at least it compiles Also I think it’s much clearer where you are in the process, and depending on the frequencies involved it might be better to use delayMicroseconds(). looks like anther ring pulse, restart timer we are stable below the threshold for a while now we don't care about rising or falling, just that State = IN_RINGING // that's the first pulse topped out New = analogRead(piezo) // read input pin0 into New and below threshold before we reset and It looked like a job for a state machine to me so I thought I’d play with that const int piezo = 0 // the piezo is connected to analog pin 0Ĭonst int RING_TIME = 5 // number of mS the pulse has to be stable Resetting when the values increase above some threshold after falling below some lower threshold might work. It is unlikely that the values are strictly increasing followed by strictly decreasing. Resetting when the values start rising again is not enough, since this assumes a constantly rising set of values, followed by a constantly falling set of values. Knowing when to reset the highest value to 0 is a bit trickier. When that happens, use the highest value. Perhaps you could note when the current reading is some number of steps lower than the highest reading. The only tricky parts are knowing when to reset the highest value variable to 0, and knowing when to actually do something with the highest value. If the value is higher, saving that in place of the previous highest value is trivial. ![]() Comparing that value to another value is trivial. If you know how to read the analog pin, then saving the value in a variable should be pretty easy. Read analog pin - it will be a stream of values rising very rapidly to maximum according to the force of a hit and decaying in about 1/2sec to 0. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |