Adjust thresholds

This commit is contained in:
Thammi 2014-09-13 11:22:58 +02:00
parent 5c3ed60f14
commit a6d4863c86
2 changed files with 7 additions and 5 deletions

View File

@ -7,6 +7,8 @@
#include <pentabug/music.h> #include <pentabug/music.h>
#include <pentabug/helper.h> #include <pentabug/helper.h>
#define BASELINE 0xa0
inline uint16_t biased_random(uint8_t value) { inline uint16_t biased_random(uint8_t value) {
return value / 2 * (rand() & 15); return value / 2 * (rand() & 15);
} }
@ -79,12 +81,12 @@ static void run(void) {
pentatonic_all_led_set(light >> 3); pentatonic_all_led_set(light >> 3);
motor_set(biased_random(light) > 0x70); motor_set(biased_random(light) > BASELINE + 0x40);
led_set(RIGHT, biased_random(light) > 0x30); led_set(RIGHT, biased_random(light) > BASELINE + 0x00);
led_set(LEFT, biased_random(light) > 0x30); led_set(LEFT, biased_random(light) > BASELINE + 0x00);
if(biased_random(light) > 0x60) { if(biased_random(light) > BASELINE + 0x20) {
uint16_t tone = (biased_random(light) * 2) + 500; uint16_t tone = (biased_random(light) * 2) + 500;
set_note(tone, 0); set_note(tone, 0);
} else { } else {

View File

@ -31,7 +31,7 @@ uint8_t photons_measure(void) {
// wait for discharge // wait for discharge
wait_ms(1); wait_ms(5);
// set direction to input for measurement // set direction to input for measurement