led刷屏c语言代码:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
//打开文件
int kk=0;
while(1)
{
int fd = open("/dev/fb0",O_RDWR);
if(-1 == fd)
{
printf("open error\n");
return -1;
}
int colors[480][800]= {0};
int t[3]= {0x0000ff00,0x00ff0000,0x000000ff};
int i,j;
if(kk==3)
{
kk=0;
}
for(i=0; i<480; i++)
{
for(j=0; j<800; j++)
{
colors[i][j]=t[kk];
}
}
kk++;
write(fd,colors,800*400*4);
sleep(1);
close(fd);
}
return 0;
}