//simple program to testing cheap 1.43euro USB to RS232 converter //this one from cute china https://www.ebay.de/itm/PL2303TA-USB-TTL-to-RS232-Konverter-Serial-Adapter-Cable-F-Win-XP-7-8-8-1-D/152701343216 //have found driver from producer side from PL2303TA chip buildet in for windows 7 etc.. //get driver here (testet no driver downloaden :3) http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41 //connectet 1x SSD1306 0.96" monochrome OLED I2C on SCK PB6 ... SDA PB7 ... GND to GND, VDD to +5V //conveted 1x RGB LED negativ all colors together on GND,positivePINS:>> PC13 to diode(resistor)to red,PC14 to gren,PC15 to blue //connected PL2303TA USB TTL to RS232 Converter on Serial1 pins: //can switch colors on/ off by command written in windows CMD: adapter TXD(grenwire) to PA10 (RX) ... adapter RXD(whitewire) to PA9 (TX) .. connet black wire to STMF103C8T6 GND and red to +5V //change tools comport to COM10 open Arduino serial monitor set bitrate to 9600(default)typein: //0red //same for green,blue, text received also shown in OLED (0 or somthibng else caused 1rst eaten up^^) //blue led on PB12 to see if traffic incomming #include #include #include #include #define OLED_RESET 12 Adafruit_SSD1306 display(OLED_RESET); #define red PC13 #define green PC14 #define blue PC15 #define meld PB12 //like cats :3 so a cute OLED bootpicture const unsigned char PROGMEM cat [] = // width 66px height 46 { 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, // ## 0x00, 0x00, 0x0F, 0x0E, 0x18, 0x60, 0x00, 0x00, 0x00, // #### ### ## ## 0x00, 0x00, 0x04, 0x94, 0xF9, 0xE0, 0x00, 0x00, 0x00, // # # # # ##### #### 0x00, 0x00, 0x02, 0x67, 0xB7, 0x40, 0x00, 0x00, 0x00, // # ## #### ## ### # 0x00, 0x3F, 0xFC, 0x22, 0x26, 0x40, 0x00, 0x00, 0x00, // ############ # # # ## # 0x01, 0xE0, 0x04, 0x62, 0x2C, 0x60, 0x00, 0x00, 0x00, // #### # ## # # ## ## 0x07, 0x00, 0x00, 0x02, 0x38, 0x3F, 0xF8, 0x00, 0x00, // ### # ### ########### 0x3C, 0x00, 0x00, 0x02, 0x10, 0x00, 0x0F, 0x80, 0x00, // #### # # ##### 0x60, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, // ## ##### #### 0xDF, 0xE0, 0x7F, 0xE0, 0x01, 0xFE, 0x00, 0x1C, 0x00, // ## ######## ########## ######## ### 0xF0, 0x30, 0xFF, 0xF0, 0x07, 0xFF, 0x00, 0x07, 0x00, // #### ## ############ ########### ### 0x80, 0x18, 0xFF, 0xF0, 0x0F, 0xFF, 0x00, 0x01, 0x80, // # ## ############ ############ ## 0xC0, 0x31, 0xFF, 0xF8, 0x1F, 0xFF, 0x83, 0xFC, 0xC0, // ## ## ############## ############## ######## ## 0x41, 0x19, 0xFF, 0xF8, 0x1F, 0xFF, 0x82, 0x07, 0xC0, // # # ## ############## ############## # ##### 0x61, 0xF1, 0xFF, 0xF8, 0x1F, 0xFF, 0xCE, 0x00, 0x40, // ## ##### ############## ############### ### # 0x20, 0x81, 0xFF, 0xFC, 0x1F, 0xFF, 0xC7, 0xC0, 0x40, // # # ############### ############### ##### # 0x30, 0x71, 0xFF, 0xFC, 0x3F, 0xFF, 0xC0, 0x40, 0xC0, // ## ### ############### ################ # ## 0x10, 0x39, 0x3F, 0xE4, 0x3F, 0xFF, 0xC1, 0x80, 0x80, // # ### # ######### # ################ ## # 0x18, 0x41, 0x00, 0x04, 0x3F, 0xFE, 0x66, 0x00, 0x80, // ## # # # ############# ## ## # 0x0E, 0x01, 0xFF, 0xE4, 0x3F, 0xF0, 0x23, 0x01, 0x80, // ### ############ # ########## # ## ## 0x03, 0x01, 0xC0, 0x3C, 0x20, 0x00, 0x20, 0x03, 0x00, // ## ### #### # # ## 0x01, 0x81, 0x00, 0x08, 0x3F, 0x00, 0x20, 0x02, 0x00, // ## # # ###### # # 0x00, 0x80, 0x00, 0x00, 0x31, 0xFE, 0x60, 0x06, 0x00, // # ## ######## ## ## 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0xC0, 0x0C, 0x00, // ## #### ## 0x00, 0x70, 0x0F, 0xE0, 0x00, 0x00, 0xC0, 0x18, 0x00, // ### ####### ## ## 0x00, 0x1C, 0x38, 0x11, 0xE7, 0xF0, 0x00, 0x30, 0x00, // ### ### # #### ####### ## 0x00, 0x04, 0x60, 0xF1, 0xC3, 0x9C, 0x00, 0x60, 0x00, // # ## #### ### ### ### ## 0x00, 0x0C, 0xC1, 0x80, 0x80, 0xC6, 0x40, 0xC0, 0x00, // ## ## ## # ## ## # ## 0x00, 0x10, 0x83, 0x00, 0x00, 0x60, 0x67, 0x80, 0x00, // # # ## ## ## #### 0x00, 0xE0, 0x06, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, // ### ## #### 0x01, 0x80, 0x04, 0x00, 0x80, 0x80, 0x30, 0x00, 0x00, // ## # # # ## 0x00, 0xFF, 0x80, 0x20, 0x81, 0xF0, 0x0E, 0x00, 0x00, // ######### # # ##### ### 0x00, 0x18, 0x60, 0x11, 0xC6, 0x18, 0x03, 0xC0, 0x00, // ## ## # ### ## ## #### 0x00, 0x60, 0x00, 0x1F, 0x7C, 0x0C, 0x3C, 0x60, 0x00, // ## ##### ##### ## #### ## 0x00, 0x7F, 0x80, 0x14, 0x28, 0x04, 0x07, 0xC0, 0x00, // ######## # # # # # ##### 0x00, 0x43, 0xF0, 0x18, 0x1E, 0x34, 0x01, 0x00, 0x00, // # ###### ## #### ## # # 0x00, 0x02, 0x1C, 0x00, 0x02, 0x1C, 0x3D, 0x00, 0x00, // # ### # ### #### # 0x00, 0x06, 0x00, 0x00, 0x03, 0x10, 0x67, 0x80, 0x00, // ## ## # ## #### 0x00, 0x01, 0xC0, 0x00, 0x01, 0xB0, 0x34, 0x00, 0x00, // ### ## ## ## # 0x00, 0x00, 0x78, 0x00, 0x00, 0xE7, 0xF8, 0x00, 0x00, // #### ### ######## 0x00, 0x00, 0x0E, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, // ### ### 0x00, 0x00, 0x03, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ## # 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // # # 0x00, 0x00, 0x01, 0x80, 0x00, 0x60, 0x00, 0x00, 0x00, // ## ## 0x00, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, // # # 0x00, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, // # # }; void setup(){ delay(100); pinMode(red, OUTPUT);pinMode(green, OUTPUT);pinMode(blue, OUTPUT);pinMode(meld, OUTPUT); Serial1.begin(9600); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); display.drawBitmap(30, 10,cat,66, 46, WHITE); display.display(); Serial1.println("MEOW ... flausch!"); delay(600); } boolean rot=false;boolean gruen=false;boolean blau=false; void loop(){ listenPCstories(); } String text=""; String digits=""; boolean einmal=true; void listenPCstories(void) { digits=""; while(Serial1.available()>0) {//crapy 1 incomming char eaten and not readet dont know why.. int cachs = Serial1.read(); text+=(char)cachs; if (isDigit(cachs)) {digits+=(char)cachs; }//think not need intwert=digits.toInt(); here einmal=true; } zeigmalher(); } void zeigmalher(void){ if(einmal==true){ digitalWrite(meld,HIGH); display.clearDisplay(); display.drawRect(0,0,128,64,WHITE); textso(2,2,text,2); schaltledsdamit(text); display.display(); Serial1.print(text); digitalWrite(meld,LOW); text=""; einmal=false; } } void schaltledsdamit(String hiermit){ if(hiermit=="red"){rotanaus();} if(hiermit=="blue"){blauanaus();} if(hiermit=="green"){greenanaus();} } void rotanaus(void){ if(rot == true) {rot=false;digitalWrite(red,LOW);}else{rot=true;digitalWrite(red,HIGH);}} void blauanaus(void){ if(blau== true){blau=false;digitalWrite(blue,LOW);}else{blau=true;digitalWrite(blue,HIGH);}} void greenanaus(void){ if(gruen==true){gruen=false;digitalWrite(green,LOW);}else{gruen=true;digitalWrite(green,HIGH);}} //for handling text and number disßplaying simpler void textso(int xhier,int yhier,String was,int gros){display.setTextColor(WHITE);display.setCursor(xhier,yhier);display.setTextSize(gros); display.print(was);} void zahlso(int xda,int yda,int mich,int grosz){String michauch=""; display.setTextSize(grosz); display.setCursor(xda,yda); display.setTextColor(WHITE); if (mich <9) {michauch+="0";} if (mich <99) {michauch+="0";} if (mich <999) {michauch+="0";} michauch+=mich; display.println(michauch);} //kote by marderchen =^.^= use if you want :3 STM32F103C8T6 not running without I2C OLED so delete display stuff if not have one