插成這樣好像在做炸彈 XD
我用的是共陰的,所以插法跟圖不太一樣
程式部分
我用的是共陰的,所以插法跟圖不太一樣
程式部分
#include <Wire.h> #include <LiquidCrystal_I2C.h> // Set the LCD address to 0x27 for a 16 chars and 2 line display LiquidCrystal_I2C lcd(0x27, 16, 2); const int row1 = 2; // the number of the row pin 9 const int row2 = 7; // the number of the row pin 14 const int row3 = 14; // the number of the row pin 8 const int row4 = 5; // the number of the row pin 12 const int row5 = 13; // the number of the row pin 1 const int row6 = 15; // the number of the row pin 7 const int row7 = 12; // the number of the row pin 2 const int row8 = 17; // the number of the row pin 5 const int col1 = 6; // the number of the col pin 13 const int col2 = 11; // the number of the col pin 3 const int col3 = 10; // the number of the col pin 4 const int col4 = 3; // the number of the col pin 10 const int col5 = 16; // the number of the col pin 6 const int col6 = 4; // the number of the col pin 11 const int col7 = 8; // the number of the col pin 15 const int col8 = 9; // the number of the col pin 16 void setup() { // initialize the LCD lcd.begin(); for(int i=2;i<=17;i++) { pinMode(i, OUTPUT); } } void loop() { int count; lcd.clear(); lcd.print("Happy"); lcd.setCursor(0, 1); lcd.print("Valentine's Day"); for(count=0;count<=2000;count++){ heart2(); } for(count=0;count<=2000;count++){ heart1(); } lcd.clear(); lcd.setCursor(3, 0); lcd.print("Hey Girl"); lcd.setCursor(1, 1); lcd.print("- I Love U -"); for(count=0;count<=2000;count++){ heart2(); } for(count=0;count<=2000;count++){ heart1(); } } void heart1(){ digitalWrite(col1,1); digitalWrite(col4,1); digitalWrite(col5,1); digitalWrite(col8,1); digitalWrite(row2,1); digitalWrite(row2,0); digitalWrite(col1,0); digitalWrite(col4,0); digitalWrite(col5,0); digitalWrite(col8,0); digitalWrite(col2,1); digitalWrite(col3,1); digitalWrite(col6,1); digitalWrite(col7,1); digitalWrite(row3,1); digitalWrite(row3,0); digitalWrite(col2,0); digitalWrite(col3,0); digitalWrite(col6,0); digitalWrite(col7,0); digitalWrite(col2,1); digitalWrite(col3,1); digitalWrite(col4,1); digitalWrite(col5,1); digitalWrite(col6,1); digitalWrite(col7,1); digitalWrite(row4,1); digitalWrite(row4,0); digitalWrite(col2,0); digitalWrite(col3,0); digitalWrite(col4,0); digitalWrite(col5,0); digitalWrite(col6,0); digitalWrite(col7,0); digitalWrite(col2,1); digitalWrite(col3,1); digitalWrite(col4,1); digitalWrite(col5,1); digitalWrite(col6,1); digitalWrite(col7,1); digitalWrite(row5,1); digitalWrite(row5,0); digitalWrite(col2,0); digitalWrite(col3,0); digitalWrite(col4,0); digitalWrite(col5,0); digitalWrite(col6,0); digitalWrite(col7,0); digitalWrite(col1,1); digitalWrite(col3,1); digitalWrite(col4,1); digitalWrite(col5,1); digitalWrite(col6,1); digitalWrite(col8,1); digitalWrite(row6,1); digitalWrite(row6,0); digitalWrite(col1,0); digitalWrite(col3,0); digitalWrite(col4,0); digitalWrite(col5,0); digitalWrite(col6,0); digitalWrite(col8,0); digitalWrite(col1,1); digitalWrite(col2,1); digitalWrite(col4,1); digitalWrite(col5,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row7,1); digitalWrite(row7,0); digitalWrite(col1,0); digitalWrite(col2,0); digitalWrite(col4,0); digitalWrite(col5,0); digitalWrite(col7,0); digitalWrite(col8,0); digitalWrite(col1,1); digitalWrite(col2,1); digitalWrite(col4,1); digitalWrite(col5,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row7,1); digitalWrite(row7,0); digitalWrite(col1,0); digitalWrite(col2,0); digitalWrite(col4,0); digitalWrite(col5,0); digitalWrite(col7,0); digitalWrite(col8,0); digitalWrite(col1,1); digitalWrite(col2,1); digitalWrite(col3,1); digitalWrite(col6,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row8,1); digitalWrite(row8,0); digitalWrite(col1,0); digitalWrite(col2,0); digitalWrite(col3,0); digitalWrite(col6,0); digitalWrite(col7,0); digitalWrite(col8,0); } void heart2(){ digitalWrite(col1,1); digitalWrite(col2,1); digitalWrite(col4,1); digitalWrite(col6,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row3,1); digitalWrite(row3,0); digitalWrite(col1,0); digitalWrite(col2,0); digitalWrite(col4,0); digitalWrite(col6,0); digitalWrite(col7,0); digitalWrite(col8,0); digitalWrite(col1,1); digitalWrite(col3,1); digitalWrite(col5,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row4,1); digitalWrite(row4,0); digitalWrite(col1,0); digitalWrite(col3,0); digitalWrite(col5,0); digitalWrite(col7,0); digitalWrite(col8,0); digitalWrite(col1,1); digitalWrite(col3,1); digitalWrite(col4,1); digitalWrite(col5,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row5,1); digitalWrite(row5,0); digitalWrite(col1,0); digitalWrite(col3,0); digitalWrite(col4,0); digitalWrite(col5,0); digitalWrite(col7,0); digitalWrite(col8,0); digitalWrite(col1,1); digitalWrite(col2,1); digitalWrite(col4,1); digitalWrite(col6,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row6,1); digitalWrite(row6,0); digitalWrite(col1,0); digitalWrite(col2,0); digitalWrite(col4,0); digitalWrite(col6,0); digitalWrite(col7,0); digitalWrite(col8,0); digitalWrite(col1,1); digitalWrite(col2,1); digitalWrite(col3,1); digitalWrite(col5,1); digitalWrite(col6,1); digitalWrite(col7,1); digitalWrite(col8,1); digitalWrite(row7,1); digitalWrite(row7,0); digitalWrite(col1,0); digitalWrite(col2,0); digitalWrite(col3,0); digitalWrite(col5,0); digitalWrite(col6,0); digitalWrite(col7,0); digitalWrite(col8,0); } void clear(){ }
留言
張貼留言