diff --git a/Code/C_Code/17.1.1_LightWater02/LightWater02 b/Code/C_Code/17.1.1_LightWater02/LightWater02 deleted file mode 100644 index 10324b0..0000000 Binary files a/Code/C_Code/17.1.1_LightWater02/LightWater02 and /dev/null differ diff --git a/Code/C_Code/17.1.1_LightWater02/LightWater02.c b/Code/C_Code/17.1.1_LightWater02/LightWater02.c index 48656e0..e676292 100644 --- a/Code/C_Code/17.1.1_LightWater02/LightWater02.c +++ b/Code/C_Code/17.1.1_LightWater02/LightWater02.c @@ -2,7 +2,7 @@ * Filename : LightWater02.c * Description : Control LED by 74HC595 * Author : freenove -* modification: 2016/06/21 +* modification: 2018/08/04 **********************************************************************/ #include #include @@ -12,6 +12,23 @@ #define latchPin 2 //ST_CP Pin of 74HC595(Pin12) #define clockPin 3 //CH_CP Pin of 74HC595(Pin11) +void _shiftOut(int dPin,int cPin,int order,int val){ + int i; + for(i = 0; i < 8; i++){ + digitalWrite(cPin,LOW); + if(order == LSBFIRST){ + digitalWrite(dPin,((0x01&(val>>i)) == 0x01) ? HIGH : LOW); + delayMicroseconds(10); + } + else {//if(order == MSBFIRST){ + digitalWrite(dPin,((0x80&(val<>=1; delay(100); diff --git a/Code/C_Code/18.1.1_SevenSegmentDisplay/SevenSegmentDisplay b/Code/C_Code/18.1.1_SevenSegmentDisplay/SevenSegmentDisplay deleted file mode 100644 index 2c9fb65..0000000 Binary files a/Code/C_Code/18.1.1_SevenSegmentDisplay/SevenSegmentDisplay and /dev/null differ diff --git a/Code/C_Code/18.1.1_SevenSegmentDisplay/SevenSegmentDisplay.c b/Code/C_Code/18.1.1_SevenSegmentDisplay/SevenSegmentDisplay.c index b276072..57d78d7 100644 --- a/Code/C_Code/18.1.1_SevenSegmentDisplay/SevenSegmentDisplay.c +++ b/Code/C_Code/18.1.1_SevenSegmentDisplay/SevenSegmentDisplay.c @@ -2,7 +2,7 @@ * Filename : SevenSegmentDisplay.c * Description : Control SevenSegmentDisplay by 74HC595 * Author : freenove -* modification: 2016/06/24 +* modification: 2018/08/04 **********************************************************************/ #include #include @@ -14,6 +14,23 @@ //encoding for character 0-F of common anode SevenSegmentDisplay. unsigned char num[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}; +void _shiftOut(int dPin,int cPin,int order,int val){ + int i; + for(i = 0; i < 8; i++){ + digitalWrite(cPin,LOW); + if(order == LSBFIRST){ + digitalWrite(dPin,((0x01&(val>>i)) == 0x01) ? HIGH : LOW); + delayMicroseconds(10); + } + else {//if(order == MSBFIRST){ + digitalWrite(dPin,((0x80&(val< #include @@ -33,6 +33,22 @@ unsigned char data[]={ // data of "0-F" 0x00, 0x00, 0x7F, 0x48, 0x48, 0x40, 0x00, 0x00, // "F" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // " " }; +void _shiftOut(int dPin,int cPin,int order,int val){ + int i; + for(i = 0; i < 8; i++){ + digitalWrite(cPin,LOW); + if(order == LSBFIRST){ + digitalWrite(dPin,((0x01&(val>>i)) == 0x01) ? HIGH : LOW); + delayMicroseconds(10); + } + else {//if(order == MSBFIRST){ + digitalWrite(dPin,((0x80&(val<>=1;// display the next column @@ -62,8 +78,8 @@ int main(void) x=0x80; // Set the column information to start from the first column for(i=k;i<8+k;i++){ digitalWrite(latchPin,LOW); - shiftOut(dataPin,clockPin,LSBFIRST,data[i]); - shiftOut(dataPin,clockPin,LSBFIRST,~x); + _shiftOut(dataPin,clockPin,MSBFIRST,data[i]); + _shiftOut(dataPin,clockPin,MSBFIRST,~x); digitalWrite(latchPin,HIGH); x>>=1; delay(1); diff --git a/Code/Python_Code/00.0.0_Hello/Hello.py b/Code/Python_Code/00.0.0_Hello/Hello.py new file mode 100644 index 0000000..47e6895 --- /dev/null +++ b/Code/Python_Code/00.0.0_Hello/Hello.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +######################################################################## +# Filename : Blink.py +# Description : Make an led blinking. +# auther : www.freenove.com +# modification: 2018/08/04 +######################################################################## + +def Hello(): + print('Hello World!') + +Hello()