Professional Documents
Culture Documents
Bài KT2.txt - LP Huy
Bài KT2.txt - LP Huy
//Nhóm SV:
// - Họ tên: Tăng Hoàng Huy MSSV: 20146342
// - Họ tên: Đỗ Đình Thi MSSV: 20146037
// - Họ tên: Bùi Lê Minh Trí MSSV: 20146442
#include <wiringPi.h>
#include <time.h>
#include <stdio.h>
#include <wiringPiSPI.h>
#include <stdint.h>
#include <stdlib.h>
int read_hour(){
int hour;
time_t currentTime = time(NULL); // Lấy thời gian hiện tại tính bằng giây
struct tm *localTime = localtime(¤tTime); // Chuyển đổi sang định dạng
ngày/giờ
hour = localTime->tm_hour;
return hour;
}
int read_minute(){
int minute;
time_t currentTime = time(NULL); // Lấy thời gian hiện tại tính bằng giây
struct tm *localTime = localtime(¤tTime); // Chuyển đổi sang định dạng
ngày/giờ
minute = localTime->tm_min;
return minute;
}
void Init(void){
//reset decode mode
send_data(0x09,0x00);
//set intensity (do sang)
send_data(0x0A,0X09);
//set scan limit (so led can quet)
send_data(0x0B,0x07);
//no shutdown
send_data(0x0C,1);
//Display test is off
send_data(0x0F,0);
}
if(wiringPiSetup() == -1) {
printf("Khong the khoi tao wiringPi\n");
return 1;
}
//set time
printf("enter off-time following the format -> hh hh mm mm: \n");
for (int i = 0; i < 4; i++)
{
scanf("%d",&numbers[i]);
printf("the value is: %d\n",numbers[i]);