dht22, main, makefile
This commit is contained in:
21
main.c
Normal file
21
main.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <wiringPi.h>
|
||||
#include "dht22.h"
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
int main(void) {
|
||||
if (wiringPiSetup () == -1)
|
||||
exit(EXIT_FAILURE) ;
|
||||
|
||||
if (setuid(getuid()) < 0)
|
||||
{
|
||||
perror("Dropping privileges failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sensor data;
|
||||
|
||||
getData(7, &data);
|
||||
printf("%.2f, %.2f\n", data.temperature, data.humidity);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user