![](/media/cache/profiles/20200518_163046.jpg.50x50_q85.jpg)
Initial
main.cpp@3:6bdfc9e9afc5, 2020-04-21 (annotated)
- Committer:
- reedas
- Date:
- Tue Apr 21 09:58:41 2020 +0000
- Revision:
- 3:6bdfc9e9afc5
- Parent:
- 2:3dabedbecf5e
Assignment version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
reedas | 0:e9613d017b5e | 1 | /* mbed Microcontroller Library |
reedas | 0:e9613d017b5e | 2 | * Copyright (c) 2019 ARM Limited |
reedas | 0:e9613d017b5e | 3 | * SPDX-License-Identifier: Apache-2.0 |
reedas | 0:e9613d017b5e | 4 | * |
reedas | 0:e9613d017b5e | 5 | * I2C Master code for Cypress PSoC 6 communicating with Arduino |
reedas | 0:e9613d017b5e | 6 | * ============================================================= |
reedas | 0:e9613d017b5e | 7 | * |
reedas | 0:e9613d017b5e | 8 | * This module sets the PSoC 6 up as the master on the I2C bus |
reedas | 0:e9613d017b5e | 9 | * and periodically collects a set of environment data from an arduino |
reedas | 0:e9613d017b5e | 10 | * running the code below: |
reedas | 2:3dabedbecf5e | 11 | */ |
reedas | 2:3dabedbecf5e | 12 | // |
reedas | 2:3dabedbecf5e | 13 | // //I2C SLAVE CODE |
reedas | 2:3dabedbecf5e | 14 | // //I2C Communication between Two Arduino |
reedas | 2:3dabedbecf5e | 15 | // //CircuitDigest |
reedas | 2:3dabedbecf5e | 16 | // //Pramoth.T |
reedas | 2:3dabedbecf5e | 17 | // |
reedas | 2:3dabedbecf5e | 18 | // #include<Wire.h> //Library for I2C Communication // // functions |
reedas | 2:3dabedbecf5e | 19 | // #include <Adafruit_Sensor.h> |
reedas | 2:3dabedbecf5e | 20 | // #include <DHT.h> |
reedas | 2:3dabedbecf5e | 21 | // #include <DHT_U.h> |
reedas | 2:3dabedbecf5e | 22 | // |
reedas | 2:3dabedbecf5e | 23 | // #define DHTPIN 4 // Digital pin connected to the DHT sensor |
reedas | 2:3dabedbecf5e | 24 | // // Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 -- |
reedas | 2:3dabedbecf5e | 25 | // // Pin 15 can work but DHT must be disconnected during program upload. |
reedas | 2:3dabedbecf5e | 26 | // |
reedas | 2:3dabedbecf5e | 27 | // // Uncomment the type of sensor in use: |
reedas | 2:3dabedbecf5e | 28 | // #define DHTTYPE DHT11 // DHT 11 |
reedas | 2:3dabedbecf5e | 29 | // //#define DHTTYPE DHT22 // DHT 22 (AM2302) |
reedas | 2:3dabedbecf5e | 30 | // //#define DHTTYPE DHT21 // DHT 21 (AM2301) |
reedas | 2:3dabedbecf5e | 31 | // |
reedas | 2:3dabedbecf5e | 32 | // // See guide for details on sensor wiring and usage: |
reedas | 2:3dabedbecf5e | 33 | // // https://learn.adafruit.com/dht/overview |
reedas | 2:3dabedbecf5e | 34 | // |
reedas | 2:3dabedbecf5e | 35 | // DHT_Unified dht(DHTPIN, DHTTYPE); |
reedas | 2:3dabedbecf5e | 36 | // |
reedas | 2:3dabedbecf5e | 37 | // uint32_t delayMS; |
reedas | 2:3dabedbecf5e | 38 | // #include <PreciseLM35.h> |
reedas | 2:3dabedbecf5e | 39 | // #define TESTING false |
reedas | 2:3dabedbecf5e | 40 | // |
reedas | 2:3dabedbecf5e | 41 | // const int pinLM35 = A2; |
reedas | 2:3dabedbecf5e | 42 | // PreciseLM35 lm35(pinLM35, DEFAULT); |
reedas | 2:3dabedbecf5e | 43 | // |
reedas | 2:3dabedbecf5e | 44 | // |
reedas | 2:3dabedbecf5e | 45 | // unsigned char txDataPacket[10]; |
reedas | 2:3dabedbecf5e | 46 | // unsigned char rxCommandPacket[8]; |
reedas | 2:3dabedbecf5e | 47 | // unsigned char rxCommandNum; |
reedas | 2:3dabedbecf5e | 48 | // unsigned char rxCommand = 0; |
reedas | 2:3dabedbecf5e | 49 | // bool SW1Pressed = 0; |
reedas | 2:3dabedbecf5e | 50 | // bool SW2Pressed = 0; |
reedas | 2:3dabedbecf5e | 51 | // |
reedas | 2:3dabedbecf5e | 52 | // int blueLed = 13; |
reedas | 2:3dabedbecf5e | 53 | // int SW1Pin = 2; |
reedas | 2:3dabedbecf5e | 54 | // int SW2Pin = 3; |
reedas | 2:3dabedbecf5e | 55 | // |
reedas | 2:3dabedbecf5e | 56 | // void setup() |
reedas | 2:3dabedbecf5e | 57 | // |
reedas | 2:3dabedbecf5e | 58 | // { |
reedas | 2:3dabedbecf5e | 59 | // pinMode(SW1Pin, INPUT); |
reedas | 2:3dabedbecf5e | 60 | // pinMode(SW2Pin, INPUT); |
reedas | 2:3dabedbecf5e | 61 | // pinMode(blueLed, OUTPUT); |
reedas | 2:3dabedbecf5e | 62 | // dht.begin(); |
reedas | 2:3dabedbecf5e | 63 | // sensor_t sensor; |
reedas | 2:3dabedbecf5e | 64 | // dht.temperature().getSensor(&sensor); |
reedas | 2:3dabedbecf5e | 65 | // dht.humidity().getSensor(&sensor); |
reedas | 2:3dabedbecf5e | 66 | // delayMS = sensor.min_delay / 1000; |
reedas | 2:3dabedbecf5e | 67 | // Serial.begin(115200); //Begins Serial Communication at // 9600 baud rate |
reedas | 2:3dabedbecf5e | 68 | // Wire.begin(8); //Begins I2C communication with // // Slave Address as 8 at pin (A4,A5) |
reedas | 2:3dabedbecf5e | 69 | // Wire.onReceive(receiveEvent); //Function call when Slave receives // value from master |
reedas | 2:3dabedbecf5e | 70 | // Wire.onRequest(requestEvent); //Function call when Master request // value from Slave |
reedas | 2:3dabedbecf5e | 71 | // } |
reedas | 2:3dabedbecf5e | 72 | // |
reedas | 2:3dabedbecf5e | 73 | // void loop(void) |
reedas | 2:3dabedbecf5e | 74 | // { |
reedas | 2:3dabedbecf5e | 75 | // unsigned char SW1Debounced; |
reedas | 2:3dabedbecf5e | 76 | // unsigned char SW2Debounced; |
reedas | 2:3dabedbecf5e | 77 | // int temperature = 20; |
reedas | 2:3dabedbecf5e | 78 | // while (1) { |
reedas | 2:3dabedbecf5e | 79 | // if (rxCommandNum || TESTING) { |
reedas | 2:3dabedbecf5e | 80 | // |
reedas | 2:3dabedbecf5e | 81 | // |
reedas | 2:3dabedbecf5e | 82 | // Serial.println("Slave Received Command From Master:"); //Prints in // // Serial Monitor |
reedas | 2:3dabedbecf5e | 83 | // Serial.print(rxCommand); |
reedas | 2:3dabedbecf5e | 84 | // Serial.print(" - "); |
reedas | 2:3dabedbecf5e | 85 | // Serial.println(rxCommandNum); |
reedas | 2:3dabedbecf5e | 86 | // for (int i = 0; i < 8; i++) { |
reedas | 2:3dabedbecf5e | 87 | // Serial.print( rxCommandPacket[i] ); |
reedas | 2:3dabedbecf5e | 88 | // Serial.print( " - " ); |
reedas | 2:3dabedbecf5e | 89 | // } |
reedas | 2:3dabedbecf5e | 90 | // Serial.println(" "); |
reedas | 2:3dabedbecf5e | 91 | // for (int i = 0; i < 10; i++) { |
reedas | 2:3dabedbecf5e | 92 | // Serial.print( txDataPacket[i] ); |
reedas | 2:3dabedbecf5e | 93 | // Serial.print( " - " ); |
reedas | 2:3dabedbecf5e | 94 | // } |
reedas | 2:3dabedbecf5e | 95 | // Serial.println(" "); |
reedas | 2:3dabedbecf5e | 96 | // rxCommandNum = 0; |
reedas | 2:3dabedbecf5e | 97 | // } |
reedas | 2:3dabedbecf5e | 98 | // sensors_event_t event; |
reedas | 2:3dabedbecf5e | 99 | // int potvalue = map( analogRead(A0), 0, 1023, 0, 100); // // Reads analog value from POT (0-5V) |
reedas | 2:3dabedbecf5e | 100 | // int lightlevel = map(analogRead(A1), 0, 1023, 0, 100); // // Ambient light level |
reedas | 2:3dabedbecf5e | 101 | // int humidityInt = 101; |
reedas | 2:3dabedbecf5e | 102 | // temperature = ((int)((lm35.readCelsius()) * 10)); // // // Ambient Temperature |
reedas | 2:3dabedbecf5e | 103 | // dht.humidity().getEvent(&event); |
reedas | 2:3dabedbecf5e | 104 | // if (isnan(event.relative_humidity)) { |
reedas | 2:3dabedbecf5e | 105 | // Serial.println(F("Error reading humidity!")); |
reedas | 2:3dabedbecf5e | 106 | // } |
reedas | 2:3dabedbecf5e | 107 | // else { |
reedas | 2:3dabedbecf5e | 108 | // humidityInt = (int)event.relative_humidity; |
reedas | 2:3dabedbecf5e | 109 | // Serial.print(F("Humidity: ")); |
reedas | 2:3dabedbecf5e | 110 | // Serial.print(humidityInt); |
reedas | 2:3dabedbecf5e | 111 | // Serial.println(F("%")); |
reedas | 2:3dabedbecf5e | 112 | // } |
reedas | 2:3dabedbecf5e | 113 | // txDataPacket[0] = potvalue; |
reedas | 2:3dabedbecf5e | 114 | // txDataPacket[1] = 0; // or potvalue >> 8; |
reedas | 2:3dabedbecf5e | 115 | // txDataPacket[2] = lightlevel; |
reedas | 2:3dabedbecf5e | 116 | // txDataPacket[3] = 0; // or lightlevel >> 8; |
reedas | 2:3dabedbecf5e | 117 | // txDataPacket[4] = temperature; |
reedas | 2:3dabedbecf5e | 118 | // txDataPacket[5] = temperature >> 8; |
reedas | 2:3dabedbecf5e | 119 | // SW1Debounced = (SW1Debounced << 1) | digitalRead(SW1Pin); |
reedas | 2:3dabedbecf5e | 120 | // if (SW1Debounced == 0) SW1Pressed = 1; |
reedas | 2:3dabedbecf5e | 121 | // SW2Debounced = (SW2Debounced << 1) | digitalRead(SW2Pin); |
reedas | 2:3dabedbecf5e | 122 | // if (SW2Debounced == 0) SW2Pressed = 1; |
reedas | 2:3dabedbecf5e | 123 | // txDataPacket[6] = SW1Pressed; |
reedas | 2:3dabedbecf5e | 124 | // txDataPacket[7] = SW2Pressed; |
reedas | 2:3dabedbecf5e | 125 | // txDataPacket[8] = humidityInt; |
reedas | 2:3dabedbecf5e | 126 | // txDataPacket[9] = 0; |
reedas | 2:3dabedbecf5e | 127 | // digitalWrite(blueLed, rxCommandPacket[1] & 1); |
reedas | 2:3dabedbecf5e | 128 | // delay(delayMS); |
reedas | 2:3dabedbecf5e | 129 | // if (TESTING) delay(2000); |
reedas | 2:3dabedbecf5e | 130 | // } |
reedas | 2:3dabedbecf5e | 131 | // } |
reedas | 2:3dabedbecf5e | 132 | // |
reedas | 2:3dabedbecf5e | 133 | // void receiveEvent (int howMany) //This Function is called // when Slave receives value from master |
reedas | 2:3dabedbecf5e | 134 | // { for (int i = 0; i < howMany; i++) { |
reedas | 2:3dabedbecf5e | 135 | // rxCommandPacket[i] = Wire.read(); //Used to read value // received from master and store in variable SlaveReceived |
reedas | 2:3dabedbecf5e | 136 | // } |
reedas | 2:3dabedbecf5e | 137 | // rxCommandNum = howMany; |
reedas | 2:3dabedbecf5e | 138 | // rxCommand = rxCommandPacket[0]; |
reedas | 2:3dabedbecf5e | 139 | // } * |
reedas | 0:e9613d017b5e | 140 | |
reedas | 0:e9613d017b5e | 141 | #include "mbed.h" |
reedas | 0:e9613d017b5e | 142 | #include "platform/mbed_thread.h" |
reedas | 0:e9613d017b5e | 143 | #include "TextLCD.h" |
reedas | 0:e9613d017b5e | 144 | #include "GUI.h" |
reedas | 0:e9613d017b5e | 145 | #include "cy8ckit_028_tft.h" |
reedas | 0:e9613d017b5e | 146 | |
reedas | 0:e9613d017b5e | 147 | |
reedas | 0:e9613d017b5e | 148 | #define UNO_CMD (0x10) // Command byte to Uno |
reedas | 0:e9613d017b5e | 149 | #define UNO_CMD_CONF (0x01) // Configuration data |
reedas | 3:6bdfc9e9afc5 | 150 | #define UNO_ADDR (0x10) // Uno i2C address |
reedas | 0:e9613d017b5e | 151 | |
reedas | 0:e9613d017b5e | 152 | //I2C i2c(P8_1, P8_0); |
reedas | 0:e9613d017b5e | 153 | I2C i2c(I2C_SDA, I2C_SCL); |
reedas | 0:e9613d017b5e | 154 | TextLCD_I2C lcd(&i2c, 0x7e, TextLCD::LCD16x2 /*, TextLCD::WS0010*/); // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type |
reedas | 2:3dabedbecf5e | 155 | TextLCD_I2C lcd2(&i2c, 0x4e, TextLCD::LCD16x2 /*, TextLCD::WS0010*/); // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type |
reedas | 0:e9613d017b5e | 156 | DigitalOut myled(LED1); |
reedas | 0:e9613d017b5e | 157 | |
reedas | 0:e9613d017b5e | 158 | //Serial pc(SERIAL_TX, SERIAL_RX); |
reedas | 0:e9613d017b5e | 159 | Serial pc(USBTX, USBRX); |
reedas | 0:e9613d017b5e | 160 | |
reedas | 0:e9613d017b5e | 161 | volatile char TempCelsiusDisplay[] = "+abc.d C"; |
reedas | 0:e9613d017b5e | 162 | |
reedas | 0:e9613d017b5e | 163 | int main() |
reedas | 0:e9613d017b5e | 164 | { |
reedas | 0:e9613d017b5e | 165 | |
reedas | 0:e9613d017b5e | 166 | char data_write[8]; |
reedas | 2:3dabedbecf5e | 167 | char data_read[10]; |
reedas | 0:e9613d017b5e | 168 | char buffer[120]; |
reedas | 3:6bdfc9e9afc5 | 169 | // i2c.frequency(400000); |
reedas | 0:e9613d017b5e | 170 | /* Initialise display */ |
reedas | 0:e9613d017b5e | 171 | GUI_Init(); |
reedas | 0:e9613d017b5e | 172 | GUI_Clear(); |
reedas | 0:e9613d017b5e | 173 | |
reedas | 0:e9613d017b5e | 174 | lcd.cls(); |
reedas | 0:e9613d017b5e | 175 | lcd.setBacklight(TextLCD::LightOn); |
reedas | 0:e9613d017b5e | 176 | lcd.setCursor(TextLCD::CurOff_BlkOff); |
reedas | 2:3dabedbecf5e | 177 | lcd2.cls(); |
reedas | 2:3dabedbecf5e | 178 | lcd2.setBacklight(TextLCD::LightOn); |
reedas | 2:3dabedbecf5e | 179 | lcd2.setCursor(TextLCD::CurOff_BlkOff); |
reedas | 0:e9613d017b5e | 180 | |
reedas | 0:e9613d017b5e | 181 | /* Configure the Temperature sensor device STLM75: |
reedas | 0:e9613d017b5e | 182 | - Thermostat mode Interrupt |
reedas | 0:e9613d017b5e | 183 | - Fault tolerance: 0 |
reedas | 0:e9613d017b5e | 184 | */ |
reedas | 0:e9613d017b5e | 185 | data_write[0] = UNO_CMD; |
reedas | 0:e9613d017b5e | 186 | data_write[1] = 0x08; |
reedas | 0:e9613d017b5e | 187 | |
reedas | 0:e9613d017b5e | 188 | GUI_SetFont(GUI_FONT_10_1); |
reedas | 0:e9613d017b5e | 189 | GUI_SetTextAlign(GUI_TA_LEFT); |
reedas | 0:e9613d017b5e | 190 | int status = i2c.write(UNO_ADDR, data_write, 2, 0); |
reedas | 0:e9613d017b5e | 191 | if (status != 0) { // Error |
reedas | 0:e9613d017b5e | 192 | GUI_DispStringAt("I2C Error", 0, 220); |
reedas | 0:e9613d017b5e | 193 | while (1) { |
reedas | 0:e9613d017b5e | 194 | myled = !myled; |
reedas | 0:e9613d017b5e | 195 | ThisThread::sleep_for(200); |
reedas | 0:e9613d017b5e | 196 | } |
reedas | 0:e9613d017b5e | 197 | } |
reedas | 0:e9613d017b5e | 198 | GUI_DispStringAt("I2C Connected", 0, 220); |
reedas | 0:e9613d017b5e | 199 | GUI_SetFont(GUI_FONT_20B_1); |
reedas | 0:e9613d017b5e | 200 | GUI_DispStringAt("Data from Arduino", 0, 0); |
reedas | 0:e9613d017b5e | 201 | |
reedas | 0:e9613d017b5e | 202 | while (1) { |
reedas | 0:e9613d017b5e | 203 | // Read Arduino data |
reedas | 0:e9613d017b5e | 204 | data_write[0] = UNO_CMD; |
reedas | 0:e9613d017b5e | 205 | i2c.write(UNO_ADDR, data_write, 2, 1); // no stop |
reedas | 2:3dabedbecf5e | 206 | if (i2c.read(UNO_ADDR, data_read, 10, 0)) { |
reedas | 0:e9613d017b5e | 207 | GUI_SetFont(GUI_FONT_10_1); |
reedas | 0:e9613d017b5e | 208 | GUI_DispStringAt("I2C receive error ", 0, 220); |
reedas | 0:e9613d017b5e | 209 | } else { |
reedas | 0:e9613d017b5e | 210 | GUI_SetFont(GUI_FONT_10_1); |
reedas | 0:e9613d017b5e | 211 | GUI_DispStringAt("I2C Data Received ", 0, 220); |
reedas | 0:e9613d017b5e | 212 | |
reedas | 3:6bdfc9e9afc5 | 213 | // read TEN bytes |
reedas | 3:6bdfc9e9afc5 | 214 | // pot value - msb-1, lsb-0 |
reedas | 3:6bdfc9e9afc5 | 215 | // light level - msb-3, lsb-2 |
reedas | 3:6bdfc9e9afc5 | 216 | // temperature - msb-5, lsb-4 |
reedas | 0:e9613d017b5e | 217 | // sw1 state - 6 - 0-255 based on how long pressed |
reedas | 0:e9613d017b5e | 218 | // sw2 state - 7 - 0-255 based on how long pressed |
reedas | 2:3dabedbecf5e | 219 | // Humidity - msb-9, lsb-8 |
reedas | 0:e9613d017b5e | 220 | |
reedas | 0:e9613d017b5e | 221 | // Calculate temperature value in Celcius |
reedas | 0:e9613d017b5e | 222 | int tempval = (int)((int)data_read[5] << 8) | data_read[4]; |
reedas | 0:e9613d017b5e | 223 | if (tempval < 0) { |
reedas | 0:e9613d017b5e | 224 | TempCelsiusDisplay[0] = '-'; |
reedas | 0:e9613d017b5e | 225 | } else { |
reedas | 0:e9613d017b5e | 226 | TempCelsiusDisplay[0] = '+'; |
reedas | 0:e9613d017b5e | 227 | } |
reedas | 0:e9613d017b5e | 228 | |
reedas | 0:e9613d017b5e | 229 | // Integer part |
reedas | 0:e9613d017b5e | 230 | TempCelsiusDisplay[1] = (tempval / 1000) + 0x30; |
reedas | 0:e9613d017b5e | 231 | TempCelsiusDisplay[2] = ((tempval % 1000) / 100) + 0x30; |
reedas | 0:e9613d017b5e | 232 | TempCelsiusDisplay[3] = ((tempval % 1000) % 100 / 10) + 0x30; |
reedas | 3:6bdfc9e9afc5 | 233 | TempCelsiusDisplay[4] = '.'; |
reedas | 0:e9613d017b5e | 234 | TempCelsiusDisplay[5] = ((tempval % 1000) % 100 % 10) + 0x30; |
reedas | 0:e9613d017b5e | 235 | |
reedas | 0:e9613d017b5e | 236 | //Switches |
reedas | 0:e9613d017b5e | 237 | |
reedas | 0:e9613d017b5e | 238 | unsigned char SW1State = data_read[6]; |
reedas | 0:e9613d017b5e | 239 | unsigned char SW2State = data_read[7]; |
reedas | 0:e9613d017b5e | 240 | |
reedas | 0:e9613d017b5e | 241 | //light level |
reedas | 0:e9613d017b5e | 242 | int lightDisplay = (int)((int)data_read[3] << 8) | data_read[2]; |
reedas | 0:e9613d017b5e | 243 | |
reedas | 0:e9613d017b5e | 244 | //potentiometer value |
reedas | 0:e9613d017b5e | 245 | int potValue = (int)((int)data_read[1] << 8) | data_read[0]; |
reedas | 2:3dabedbecf5e | 246 | |
reedas | 3:6bdfc9e9afc5 | 247 | // humidity value |
reedas | 2:3dabedbecf5e | 248 | int humidity = (int)((int)data_read[9] << 8) | data_read[8]; |
reedas | 0:e9613d017b5e | 249 | |
reedas | 0:e9613d017b5e | 250 | // Display result |
reedas | 2:3dabedbecf5e | 251 | pc.printf("temp = %s, Light is %3d%%, Hum is %3d%%%s%s\n", TempCelsiusDisplay, lightDisplay, humidity, SW1State?", SW1 pressed":"", SW2State?", SW2 pressed":""); |
reedas | 0:e9613d017b5e | 252 | |
reedas | 0:e9613d017b5e | 253 | lcd.locate(0,0); |
reedas | 2:3dabedbecf5e | 254 | lcd.printf("Temp Lght Hum 12"); |
reedas | 0:e9613d017b5e | 255 | lcd.locate(0,1); |
reedas | 2:3dabedbecf5e | 256 | lcd.printf(" %2dC %2d%c %2d%c %s%s", tempval/10, lightDisplay, 0x25, humidity, 0x25, SW1State?"1":"_", SW2State?"2":"_"); |
reedas | 2:3dabedbecf5e | 257 | lcd2.locate(0,0); |
reedas | 2:3dabedbecf5e | 258 | lcd2.printf("Temp Lght Pot 12"); |
reedas | 2:3dabedbecf5e | 259 | lcd2.locate(0,1); |
reedas | 2:3dabedbecf5e | 260 | lcd2.printf(" %2dC %2d%c %2d%c %s%s", tempval/10, lightDisplay, 0x25, potValue, 0x25, SW1State?"1":"_", SW2State?"2":"_"); |
reedas | 0:e9613d017b5e | 261 | |
reedas | 3:6bdfc9e9afc5 | 262 | sprintf(buffer,"Temp is %2fC \nLight Level is %2d%c \nPot Value is %2d%c \nHumidity is %2d%c \n%s \n%s ", tempval/10, lightDisplay, 0x25, potValue, 0x25, humidity, 0x25, SW1State?"SW1 Pressed ":"SW1 Released", SW2State?"SW2 Pressed ":"SW2 Released"); |
reedas | 0:e9613d017b5e | 263 | GUI_SetFont(GUI_FONT_20_1); |
reedas | 0:e9613d017b5e | 264 | GUI_DispStringAt(buffer, 0, 40); |
reedas | 0:e9613d017b5e | 265 | } |
reedas | 0:e9613d017b5e | 266 | myled = !myled; |
reedas | 2:3dabedbecf5e | 267 | data_write[1] = data_write[1] ^ 0x01; |
reedas | 2:3dabedbecf5e | 268 | thread_sleep_for(250); |
reedas | 0:e9613d017b5e | 269 | } |
reedas | 0:e9613d017b5e | 270 | |
reedas | 0:e9613d017b5e | 271 | } |
reedas | 0:e9613d017b5e | 272 |