ayufan-pine64 / dht22-pine64 Goto Github PK
View Code? Open in Web Editor NEWSimple application to read DHT22 value on Pine A64
Simple application to read DHT22 value on Pine A64
First of all the code works pretty well and I can easily work around the issue! But sometimes I get random errors like "Invalid CRC" or "Not enough bits". I get what is going on there in the code, I just dont know if it is an issue with my hardware, some timing issue or a sensor issue.
Is that normal?
Thanks in advance.
Humidity: 44.1 %
Temperature: 29.2 *C
Humidity: 44.0 %
Temperature: 29.2 *C
Humidity: 44.0 %
Temperature: 29.1 *C
Humidity: 44.0 %
Temperature: 29.1 *C
Invalid CRC
Not enough bits: 0
Not enough bits: 0
Not enough bits: 0
Humidity: 44.0 %
Temperature: 29.1 *C
Humidity: 43.9 %
Temperature: 29.1 *C
Humidity: 44.0 %
Temperature: 29.1 *C
Not enough bits: 39
Not enough bits: 0
Not enough bits: 0
Not enough bits: 0
Humidity: 44.0 %
Temperature: 29.1 *C
Hi,
We are trying to use it but having segmentation fault each time and we are having a bunch of warning while me "make" it!
g++ -fpermissive -Wno-write-strings -o dht22 .c
c_gpio.c: In function ‘int setup()’:
c_gpio.c:129:23: warning: cast from ‘volatile uint32_t’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
if ((uint32_t)gpio_map < 0) {
^~~~~~~~
c_gpio.c:176:27: warning: invalid conversion from ‘void*’ to ‘uint8_t*’ {aka ‘unsigned char*’} [-fpermissive]
if ((gpio_mem = malloc(BLOCK_SIZE + (PAGE_SIZE-1))) == NULL)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
c_gpio.c:179:19: warning: cast from ‘uint8_t*’ {aka ‘unsigned char*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
if ((uint32_t)gpio_mem % PAGE_SIZE)
^~~~~~~~
c_gpio.c:180:44: warning: cast from ‘uint8_t*’ {aka ‘unsigned char*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
gpio_mem += PAGE_SIZE - ((uint32_t)gpio_mem % PAGE_SIZE);
^~~~~~~~
c_gpio.c:189:19: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
if ((uint32_t)gpio_map < 0)
^~~~~~~~
c_gpio.c: In function ‘uint32_t sunxi_readl(volatile uint32_t*)’:
c_gpio.c:282:36: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_base = (uint32_t)addr & (~MAP_MASK);
^~~~
c_gpio.c:283:37: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_seek = ((uint32_t)addr - mmap_base) >> 2;
^~~~
c_gpio.c: In function ‘void sunxi_writel(volatile uint32_t*, uint32_t)’:
c_gpio.c:290:36: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_base = (uint32_t)addr & (~MAP_MASK);
^~~~
c_gpio.c:291:37: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_seek =( (uint32_t)addr - mmap_base) >> 2;
^~~~
c_gpio.c: In function ‘int eventdetected(int)’:
c_gpio.c:219:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.