In the second part of this installation, I added sensors that will trigger siren and objects to obstruct people to take the candy. One pressure sensor will be place on the floor where the weights will be, this will trigger the siren. While another pressure sensor will be below the weight to turn on the object that will swing 360 to hit on people’s leg.
I started coding by using max, connect through icubex to the pressure sensor. The problem I face was when I wanted to test it in my laptop, after I install everything is needed such as library and driver but the USB port seems not recognising icubex, hence no sensor can be detect in max or connect. In the end after search the problem in the internet, I realise it was the system security that was blocking the driver. Icubex can be detected after it was unblocked.
Next, the number received from the sensor will send a bang to trigger the sound. Another sensor are connect to Arduino through serial communication and sending numbers 0 and 1. Initially in arduino, I uses delay to control the motor, but it cause problems in my system as it will lack and cause the numbers to stack up. So I change to Millis instead, so when the weight a place down it will instantly stop the turning.