├── README.md ├── oledbluetest2 └── oledbluetest2.ino ├── part-a.stl ├── part-b.stl ├── part-c.stl ├── part-d.stl ├── part-e-45b.stl └── serialtest3 └── serialtest3.ino /README.md: -------------------------------------------------------------------------------- 1 | # Arduino-Glass 2 | My DIY Arduino Glass. 3 | -------------------------------------------------------------------------------- /oledbluetest2/oledbluetest2.ino: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include // Include Wire if you're using I2C 4 | #include // Include SPI if you're using SPI 5 | #include // Include the SFE_MicroOLED library 6 | 7 | ////////////////////////// 8 | // MicroOLED Definition // 9 | ////////////////////////// 10 | #define PIN_RESET 9 // Connect RST to pin 9 (req. for SPI and I2C) 11 | #define PIN_DC 8 // Connect DC to pin 8 (required for SPI) 12 | #define PIN_CS 10 // Connect CS to pin 10 (required for SPI) 13 | #define DC_JUMPER 0 14 | // Also connect pin 13 to SCK and pin 11 to MOSI 15 | 16 | ////////////////////////////////// 17 | // MicroOLED Object Declaration // 18 | ////////////////////////////////// 19 | // Declare a MicroOLED object. The parameters include: 20 | // 1 - Reset pin: Any digital pin 21 | // 2 - D/C pin: Any digital pin (SPI mode only) 22 | // 3 - CS pin: Any digital pin (SPI mode only, 10 recommended) 23 | MicroOLED oled(PIN_RESET, PIN_DC, PIN_CS); 24 | //MicroOLED oled(PIN_RESET, DC_JUMPER); // Example I2C declaration 25 | 26 | // I2C is great, but will result in a much slower update rate. The 27 | // slower framerate may be a worthwhile tradeoff, if you need more 28 | // pins, though. 29 | String bluedata; 30 | String command; 31 | byte value; 32 | byte valueall[15]; 33 | char valuechar[15]; 34 | 35 | void setup() 36 | { 37 | Serial1.begin(9600); 38 | oled.begin(); // Initialize the OLED 39 | delay(1000); 40 | oled.clear(ALL); // Clear the display's internal memory 41 | oled.display(); // Display what's in the buffer (splashscreen) 42 | // Delay 1000 ms 43 | oled.clear(PAGE); 44 | oled.display(); 45 | 46 | oled.setFontType(1); 47 | oled.setCursor(0, 0); 48 | oled.print("ArduinoGlasses V1.0"); 49 | oled.display(); 50 | delay(2000); 51 | oled.clear(ALL); 52 | oled.clear(PAGE); 53 | oled.display(); 54 | oled.setCursor(0, 10); 55 | oled.print("Glasses"); 56 | oled.setCursor(10, 30); 57 | oled.print("Ready"); 58 | oled.display(); 59 | // oled.clear(ALL); 60 | oled.clear(PAGE); 61 | } 62 | 63 | void loop() 64 | { 65 | if(Serial1.available()){ 66 | delay(100); 67 | while(Serial1.available()) { 68 | value = (Serial1.read()); 69 | if (value == 43 || value == 45){ 70 | 71 | for (int i=0; i <= 15; i++){ 72 | 73 | valueall[i] = value; 74 | value = (Serial1.read()); 75 | 76 | } 77 | int a=0; 78 | String value = ((char*)valueall); 79 | //oled.println(test.substring(0, 6)); 80 | 81 | 82 | for (a=0; a <=15; a++){ 83 | //oled.print(valueall[a]); 84 | valuechar[a]=valueall[a]; 85 | //oled.print("-"); 86 | 87 | } 88 | //oled.clear(ALL); 89 | //oled.clear(PAGE); 90 | oled.setCursor(0, 20); 91 | //command = valuechar[1];command += valuechar[2];command += valuechar[3];command += valuechar[4]; // build number 92 | if (valuechar[0] == 43 && valueall[7] == 49) oled.print("+"); 93 | if (valuechar[0] == 45 && valueall[7] == 49) oled.print("-"); 94 | if (valuechar[0] == 43 && valueall[7] == 41) oled.print("~"); 95 | if (valuechar[0] == 45 && valueall[7] == 41) oled.print("~"); 96 | if (valuechar[0] == 43 && valueall[7] == 17) oled.print("+"); 97 | if (valuechar[0] == 45 && valueall[7] == 17) oled.print("-"); 98 | if (valuechar[0] == 43 && valueall[7] == 9) oled.print("~"); 99 | if (valuechar[0] == 45 && valueall[7] == 9) oled.print("~"); 100 | 101 | oled.print(valuechar[1]); 102 | if (valueall[6] == 49) oled.print("."); 103 | oled.print(valuechar[2]); 104 | if (valueall[6] == 50) oled.print("."); 105 | oled.print(valuechar[3]); 106 | if (valueall[6] == 52) oled.print("."); 107 | oled.print(valuechar[4]); 108 | 109 | oled.setCursor(0, 35); 110 | if (valueall[9] == 64 && valueall[10] == 128) oled.print("mV"); 111 | if (valueall[9] == 0 && valueall[10] == 128) oled.print("V"); 112 | if (valueall[9] == 0 && valueall[10] == 32) oled.print("R"); 113 | if (valueall[9] == 32 && valueall[10] == 32) oled.print("K"); 114 | if (valueall[9] == 16 && valueall[10] == 32) oled.print("M"); 115 | if (valueall[9] == 0 && valueall[10] == 64) oled.print("A"); 116 | if (valueall[9] == 64 && valueall[10] == 64) oled.print("mA"); 117 | if (valueall[9] == 128 && valueall[10] == 64) oled.print("uA"); 118 | if (valueall[9] == 0 && valueall[10] == 2) oled.print("Grad C"); 119 | if (valueall[9] == 0 && valueall[10] == 1) oled.print("Grad F"); 120 | if (valueall[9] == 0 && valueall[10] == 8) oled.print("Hz"); 121 | oled.display(); 122 | oled.clear(PAGE); 123 | } 124 | } 125 | } 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | } 135 | -------------------------------------------------------------------------------- /part-a.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awall9999/Arduino-Glass/bfdca14be45d8ed04e36bceea02b36726a703a63/part-a.stl -------------------------------------------------------------------------------- /part-b.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awall9999/Arduino-Glass/bfdca14be45d8ed04e36bceea02b36726a703a63/part-b.stl -------------------------------------------------------------------------------- /part-c.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awall9999/Arduino-Glass/bfdca14be45d8ed04e36bceea02b36726a703a63/part-c.stl -------------------------------------------------------------------------------- /part-d.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awall9999/Arduino-Glass/bfdca14be45d8ed04e36bceea02b36726a703a63/part-d.stl -------------------------------------------------------------------------------- /part-e-45b.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awall9999/Arduino-Glass/bfdca14be45d8ed04e36bceea02b36726a703a63/part-e-45b.stl -------------------------------------------------------------------------------- /serialtest3/serialtest3.ino: -------------------------------------------------------------------------------- 1 | 2 | void setup() { 3 | Serial.begin(9600); // opens serial port, sets data rate to 9600 bps 4 | Serial1.begin(9600); // opens serial port 1, sets data rate to 9600 bps 5 | } 6 | 7 | void loop() { 8 | 9 | if (Serial1.available()) 10 | Serial.write(Serial1.read()); //read data from Bluetooth and send it to USB 11 | if (Serial.available()) 12 | Serial1.write(Serial.read()); //read data from USB and send it to Bluetooth 13 | } 14 | --------------------------------------------------------------------------------