Problem with GPIO Shield for Arduino V1.0 SKU: DFR0334

Hey all,
I'm doing up a project which involves using the dfr0334.
I have connected it to my onion omega 2+ via the arduino dock 2.
I have ammended the source code provided on the product manual for my use as shown below:
"Failed to read from DHT sensor!"
I've tried the setup without the gpio shield and I do get correct input, so there's no hardware problem with the sensor.
also, I cannot flash the code to my arduino dock unit when the gpio shield is attached. however, all is good if the shield is removed.
tldr:
1)Problem getting input from DHT22 sensor through GPIO Shield for Arduino V1.0
2) Can only upload to arduino dock 2 when the shield is removed
I'm doing up a project which involves using the dfr0334.
I have connected it to my onion omega 2+ via the arduino dock 2.
I have ammended the source code provided on the product manual for my use as shown below:
Code: Select all
however, when i tried to screen though the onion using PuTTY, there an error is getting an input from my dht22 sensor unit:#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "clsPCA9555.h"
#include "Wire.h"
PCA9555 ioport(0x20);
//all above is to intialise GPIO Shield
#include "DHT.h"
#define DHTPIN 2 // what digital pin we're connected to
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors. This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);
//pir motion sensor
byte sensorPin = 3;
byte indicator = 13;
void setup() {
Serial.begin(9600);
pinMode(sensorPin,INPUT);
pinMode(indicator,OUTPUT);
Serial.println("DHTxx test!");
ioport.pinMode(2, INPUT); //Button
dht.begin();
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
byte state = digitalRead(sensorPin);
digitalWrite(indicator,state);
// read the input on analog pin A0:
int sensorValue0 = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage0 = sensorValue0;
// print out the value you read:
int sensorValue1 = analogRead(A1);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage1 = sensorValue1;
// print out the value you read:
// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);
Serial.print("Motion:");
if(state == 1)Serial.print("1\t");
else if(state == 0)Serial.print("0\t");
Serial.print("CO2 Level:");
Serial.print(voltage0);
Serial.print("\t");
Serial.print("Noise Level:");
Serial.print(sensorValue1);
Serial.print("\t");
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
//Serial.print(f);
//Serial.print(" *F\t");
//Serial.print("Heat index: ");
//Serial.print(hic);
//Serial.print(" *C ");
//Serial.print(hif);
//Serial.println(" *F");
}
"Failed to read from DHT sensor!"
I've tried the setup without the gpio shield and I do get correct input, so there's no hardware problem with the sensor.
also, I cannot flash the code to my arduino dock unit when the gpio shield is attached. however, all is good if the shield is removed.
tldr:
1)Problem getting input from DHT22 sensor through GPIO Shield for Arduino V1.0
2) Can only upload to arduino dock 2 when the shield is removed
