commit cc402ce4fa95ebd58b1c6ba47f75185fb993b7e2 Author: James Devine Date: Sun Oct 16 16:53:18 2016 +0200 diff --git a/Cosmic Pi Trigger Threshold test b/Cosmic Pi Trigger Threshold test new file mode 100644 index 0000000..d657032 --- /dev/null +++ b/Cosmic Pi Trigger Threshold test @@ -0,0 +1,63 @@ +#include + +//this test works when testing with boards 1 and 2 +//set the threshold as a 1 time value, max is 3.3V (voltage reference removed from protos) +//crashes due to 50Hz noise +//input thresholds not checked 100% +//minimum input signal duration 40ns for coincidence. +//at 40ns incident coincidence the output lasts for 150ns - plenty for the DUE to capture. +//Hardware is more reliable than DUE's noise immunity. +//Note the MAX5387LAUD+ doesn't support I2C readback. + +void setup() { + // put your setup code here, to run once: + pinMode(48, OUTPUT); + pinMode(49, OUTPUT); + pinMode(35, OUTPUT); + pinMode(36, OUTPUT); + pinMode(37, OUTPUT); + pinMode(A1, INPUT); + pinMode(A2, INPUT); + digitalWrite(35, LOW); + digitalWrite(36, LOW); + digitalWrite(37, LOW); + //pinMode(38, INPUT); + //pinMode(39, INPUT); + pinMode(5, INPUT); + attachInterrupt(38, striga, RISING); + attachInterrupt(39, strigb, RISING); + attachInterrupt(5, realint, RISING); + Wire.begin(); + Serial.begin(9600); + Serial.print("Address "); + Serial.print(0x28, HEX); + Wire.beginTransmission(byte(0x28)); // transmit to device #112 + Wire.write(byte(B00010011)); + Wire.write(byte(0x50));// sets register pointer to echo #1 register (0x02) + Wire.endTransmission(); // stop transmitting + Serial.println("threshold set to 0x80"); + //digitalWrite(48, HIGH); + //digitalWrite(49, HIGH); +} + +void striga(){ +Serial.print("a"); +} +void strigb(){ +Serial.println("b"); +} +void realint(){ +Serial.println("real"); +} +void loop() { + // put your main code here, to run repeatedly: + //delay(100); + +//digitalWrite(48, HIGH); +//digitalWrite(49, HIGH); + + +//digitalWrite(48, LOW); +//digitalWrite(49, LOW); +//delay(1000); +} \ No newline at end of file