uni

Thing1's amazing uni repo
Log | Files | Refs

calibrate.ino (904B)


      1 #include <EEPROM.h>
      2 #include <stdint.h>
      3 #include "helper.h"
      4 
      5 void
      6 setup() {
      7 	Serial.begin(9600);
      8 
      9 	/* black calibration */
     10 	SEprintf("expecting to be on black\n");
     11 	delay(3000);
     12 
     13 	/* repeatedly changes calibration values for each ldr until returning consistant data */
     14 	while (isLDRBright(LDRA)) LDRA_SWITCH++;
     15 	while (isLDRBright(LDRB)) LDRB_SWITCH++;
     16 	while (isLDRBright(LDRC)) LDRC_SWITCH++;
     17 
     18 	SEprintf("%d, %d, %d\n\n", LDRA_SWITCH + 100, LDRB_SWITCH + 100, LDRC_SWITCH + 100);
     19 
     20 	EEPROM.put(6, LDRA_SWITCH + 100);
     21 	EEPROM.put(10, LDRB_SWITCH + 100);
     22 	EEPROM.put(14, LDRB_SWITCH + 100);
     23 
     24 	/* setting robots values, my robots values for fwd motion were the same on both servos so i just use SPEED, other robots will need different values */
     25 	EEPROM.put(0, (uint8_t)SERVOA_ZERO);
     26 	EEPROM.put(1, (uint8_t)SPEEDA);
     27 	EEPROM.put(2, (uint8_t)SERVOB_ZERO);
     28 	EEPROM.put(3, (uint8_t)SPEEDB);
     29 }
     30 
     31 void
     32 loop() {
     33 }