설계도를 기반으로 3D 프린터 제작과 코딩을 통해 가빈을 제작해 나간다.
#include <SoftwareSerial.h>
= A0; // 태양광 패널 인풋
int solar_input
setup() {
void Serial.begin(9600);
pinMode(solar_input, INPUT); // 태양광 전류 인풋
}
loop() {
void
int solar_value;= analogRead(solar_input);
solar_value
delay(1000);
Serial.print(" salor panel = ");
Serial.print(solar_value);
Serial.print("\n");
}
=
unsigned char LED_0F[] // 0 1 2 3 4 5 6 7 8 9 A b C d E F -
{0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x8C,0xBF,0xC6,0xA1,0x86,0xFF,0xbf
};4]; //用于LED的4位显示缓存
unsigned char LED[= 2;
int SCLK = 1;
int RCLK = 0; //这里定义了那三个脚
int DIO setup ()
void
{pinMode(SCLK,OUTPUT);
pinMode(RCLK,OUTPUT);
pinMode(DIO,OUTPUT); //让三个脚都是输出状态
}loop()
void
{0]=1;
LED[1]=2;
LED[2]=3;
LED[3]=4;
LED[while(1)
{LED4_Display ();
}
}
#include<SoftwareSerial.h>
= 9;
int fan = A0; // 태양광 패널 인풋
int x
int a;
int b;
int c;
int d;
=
unsigned char LED_0F[] // 0 1 2 3 4 5 6 7 8 9 A b C d E F -
{0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x8C,0xBF,0xC6,0xA1,0x86,0xFF,0xbf
};
4]; //用于LED的4位显示缓存
unsigned char LED[
= 2;
int SCLK = 1;
int RCLK = 0; //这里定义了那三个脚
int DIO setup ()
void
{Serial.begin(9600);
pinMode(fan, OUTPUT);
pinMode(x, INPUT); // 태양광 전류 인풋
pinMode(SCLK,OUTPUT);
pinMode(RCLK,OUTPUT);
pinMode(DIO,OUTPUT); //让三个脚都是输出状态
}
loop()
void
{
int x;
int a;
int b;
int c;
int d;
=floor(x);
a=floor(x/10);
b=floor(x/100);
c=floor(x/1000);
d
=b%10;
b=analogRead(b);
b
delay(1);
Serial.print(" a = ");
Serial.print(a);
= analogRead(x);
x delay(1);
Serial.print(" salor panel = ");
Serial.print(x);
= analogRead(a);
a delay(1);
Serial.print(" a = ");
Serial.print(b);
digitalWrite(fan, HIGH);
delay(1); // fan 100초 동안 가동
0]=a%10;
LED[1]=b%10;
LED[2]=c%10;
LED[3]=d%10;
LED[
while(1)
{LED4_Display ();
}
}
LED4_Display (void)
void
{*led_table; // 查表指针
unsigned char
unsigned char i;//显示第1位
= LED_0F + LED[0];
led_table = *led_table;
i
LED_OUT(i);
LED_OUT(0x01);
digitalWrite(RCLK,LOW);
digitalWrite(RCLK,HIGH);
//显示第2位
= LED_0F + LED[1];
led_table = *led_table;
i
LED_OUT(i);
LED_OUT(0x02);
digitalWrite(RCLK,LOW);
digitalWrite(RCLK,HIGH);
//显示第3位
= LED_0F + LED[2];
led_table = *led_table;
i LED_OUT(i);
LED_OUT(0x04);
digitalWrite(RCLK,LOW);
digitalWrite(RCLK,HIGH);
//显示第4位
= LED_0F + LED[3];
led_table = *led_table;
i
LED_OUT(i);
LED_OUT(0x08);
digitalWrite(RCLK,LOW);
digitalWrite(RCLK,HIGH);
}
LED_OUT(unsigned char X)
void
{
unsigned char i;
for(i=8;i>=1;i--)
{if (X&0x80)
{digitalWrite(DIO,HIGH);
} else
{digitalWrite(DIO,LOW);
}
<<=1;
XdigitalWrite(SCLK,LOW);
digitalWrite(SCLK,HIGH);
}
}