Loading...
  Show Posts
Pages: [1] 2 3 ... 14
1  Using Arduino / Installation & Troubleshooting / Re: New packaging? on: March 04, 2013, 08:20:24 am
It is the new original! Do not worry  smiley
2  Using Arduino / Installation & Troubleshooting / Add library folder on: March 04, 2013, 05:39:03 am
Hello. Do anyone knows if it's possible to add a libraries folder (for example editing the preferencies.txt file)?
I want to keep separate libraries that I use in different projecs but I don't know how to do this.
Thanks in advance for you help!
3  Using Arduino / Networking, Protocols, and Devices / wifi shiled Microchip MRF24WB0MA and DHCP on: January 10, 2013, 11:24:06 am
Hi, I have brought a wifi shield based on the Microchip MRF24WB0MA (http://www.electronics-lab.com/blog/?tag=mrf24wb0ma) and I have found this useful library to make it work (http://code.google.com/p/wifi-shield-oe/downloads/list).
Do you know if there is another library that support DHCP like the one included in the IDE (http://arduino.cc/en/Reference/WiFi) that unfortunatly works with another shield?

Thanks in advance for your help
4  Using Arduino / Programming Questions / Re: Simple code is not working as expected on: November 20, 2012, 11:35:49 am
what is D(a,b) for?
5  Using Arduino / Programming Questions / release 1.0.2 Automatically create libraries folder in the sketchbook on: November 20, 2012, 11:32:20 am
on the release notes v 1.0.2 it is written:
Quote
* Automatically create libraries folder in the sketchbook.
  (Paul Stoffregen)
  http://code.google.com/p/arduino/issues/detail?id=986
could anyone explain me what this means?
Thanks in advance
6  Using Arduino / Programming Questions / Re: Searching string in char array on: October 30, 2012, 03:34:41 am
does this code
Code:
    Serial.println("\nNumber of data received:");
    Serial.println(numdata);
    Serial.println("\nData received:");
    Serial.println(msg);
demostrates you "msg" is not empty?

looking at http://arduino.cc/en/Tutorial/StringConstructors I am not sure you can pass a vector in this way doing a sort of cast "String(msg);" try to use this "string.toCharArray(buf, len)"
7  Using Arduino / Programming Questions / Re: 1 wire and 4 wire communications confilict on: October 30, 2012, 03:27:51 am
Ok, I have discovered the problem is not between 1 wire and 4 wire communication. Using this library http://learn.adafruit.com/dht everything works. I will try to understand what in the other library conflicts. Any idea is appreciated.
8  Using Arduino / Programming Questions / Re: Two functions, only second in order works. on: October 29, 2012, 10:36:28 am
where do you call the functions giving them parameters?
9  Using Arduino / Programming Questions / Re: How do I stop an Arduino sketch? on: October 29, 2012, 10:33:23 am
you can do what you want in the "Setup" if you want to do it only once.
10  Using Arduino / Programming Questions / 1 wire and 4 wire communications confilict on: October 29, 2012, 09:09:02 am
Do anyone knows if there is a conflict using 1wire and 4wire communications at the same time? I have a program that tries to use an SD card to write on a sensor value taken from the dht22 that works with the 1 wire protocol. I haven't conflicts between the sd pins an the sensor pin. But after the "SD.begin" the sensor does not answer to arduino (dht22 start condition 1 not met). Without SD begin everything is ok.

This is the code:
Code:
#include "dht22.h"
#include <SD.h>


dht22 mioTwigTempHum(A2);

void setup()
{
  Serial.begin(9600);
 
 
     //inizializzo la parte della scheda SD                SETUP->SD
   Serial.println("Initializing SD card...");
   // disable w5100 SPI while setting up SD
  pinMode(10,OUTPUT);
  digitalWrite(10, HIGH);//per arduino mega http://arduino.cc/forum/index.php/topic,46976.0.html
 
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
   pinMode(53, OUTPUT);
   digitalWrite(53, HIGH);
   
  if (!SD.begin(4)) {
    Serial.println("non potra' salvare su SD!");
   
  }
}


void loop()
{
  mioTwigTempHum.aggiornaValori();
  Serial.println(mioTwigTempHum.umidita );
  Serial.println(mioTwigTempHum.temperatura );
  delay(1000); // wait for one second
}

and this is the sensor library
.H
Code:
#ifndef dht22_h
#define dht22_h


class dht22
{
private:
int analogInArduino;     //pin arduino dove e' connesso il sensore
unsigned char read_dht22_dat();

public:
dht22(int analogInArduino); //costruttore   
~dht22( ); //distruttore

    bool aggiornaValori(); //aggiorna le variabili umidita e temperatura
    float umidita;
    float temperatura;
};




#endif


.CPP
Code:

/******************************************************************************
 * Includes
 ******************************************************************************/

#include "dht22.h"
  #if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #else
  #include "WProgram.h"
  #endif //Arduino includes

/******************************************************************************
 * Definitions
 ******************************************************************************/

/******************************************************************************
 * Constructors
 ******************************************************************************/

dht22::dht22(int analogInArduino)
{
   this->analogInArduino=analogInArduino;
   pinMode(analogInArduino,OUTPUT);
}


dht22::~dht22( )
{
}


/******************************************************************************
 * User API
 ******************************************************************************/



bool dht22::aggiornaValori()
{
byte dht22_dat[5];
byte i;


  // start condition
  // 1. pull-down i/o pin from 18ms
  digitalWrite(analogInArduino,LOW);
  delay(18);
 
  digitalWrite(analogInArduino,HIGH);
  delayMicroseconds(40);

      pinMode(analogInArduino,INPUT);


  if(digitalRead(analogInArduino)){
    Serial.println("dht22 start condition 1 not met");
    return(false);
  }
  delayMicroseconds(80);



  if(!digitalRead(analogInArduino)){
    Serial.println("dht22 start condition 2 not met");
    return(false);
  }
  delayMicroseconds(80);
  // now ready for data reception
  for (i=0; i<5; i++)
    dht22_dat[i] = read_dht22_dat();

  pinMode(analogInArduino,OUTPUT);
  digitalWrite(analogInArduino,HIGH);

  byte dht22_check_sum = dht22_dat[0]+dht22_dat[1]+dht22_dat[2]+dht22_dat[3];
  // check check_sum
  if(dht22_dat[4]!= dht22_check_sum)
  {
  Serial.println("DHT22 checksum error");
return(false);
  }
  umidita=((float)(dht22_dat[0]*256+dht22_dat[1]))/10;
  temperatura=((float)(dht22_dat[2]*256+dht22_dat[3]))/10;
  return(true);
}


unsigned char dht22::read_dht22_dat()
{
  byte i = 0;
  byte result=0;
  for(i=0; i< 8; i++){
    while(!digitalRead(analogInArduino));  // wait for 50us
    delayMicroseconds(30);
 
    if(digitalRead(analogInArduino))
      result |=(1<<(7-i));
    while(digitalRead(analogInArduino));  // wait '1' finish
  }
  return result;
}


I have tested this on the arduino 2560 and the duemilanove. For the sd I have used the ethernet shield and the wireless sd shiled.
Do you have any idea of the reason of the conflicts considering that pins are not in conflicts?
Thanks in advance
11  Using Arduino / Programming Questions / Re: Seeedstudio temperature and humidity code on: October 26, 2012, 08:49:00 am
Ok, I but why? pin 14 for A0?
12  Using Arduino / Programming Questions / Seeedstudio temperature and humidity code on: October 26, 2012, 05:22:12 am
Hello. I have dowloaded this code from seeedstudio:
Quote
/*
 * Version 1.0 April, 2012
 * Copyright 2012 Joinj
 * http://www.seeedstudio.com
 */
#define DHT11_PIN 14      // ADC0
 
byte read_dht11_dat()
{
  byte i = 0;
  byte result=0;
  for(i=0; i< 8; i++){
    while(!digitalRead(DHT11_PIN));  // wait for 50us
    delayMicroseconds(30);
 
    if(digitalRead(DHT11_PIN))
      result |=(1<<(7-i));
    while(digitalRead(DHT11_PIN));  // wait '1' finish
  }
  return result;
}
void setup()
{
  pinMode(DHT11_PIN,OUTPUT);
  Serial.begin(9600);
  Serial.println("Ready");
}
 
void loop()
{
  byte dht11_dat[5];
  byte dht11_in;
  byte i;
  float humdity,temperature;
  // start condition
  // 1. pull-down i/o pin from 18ms
  digitalWrite(DHT11_PIN,LOW);
  delay(18);
 
  digitalWrite(DHT11_PIN,HIGH);
  delayMicroseconds(40);
 
  pinMode(DHT11_PIN,INPUT);
 
  while(digitalRead(DHT11_PIN)){
    Serial.println("dht11 start condition 1 not met");
  }
  delayMicroseconds(80);
 
  while(!digitalRead(DHT11_PIN)){
    Serial.println("dht11 start condition 2 not met");
  }
  delayMicroseconds(80);
  // now ready for data reception
  for (i=0; i<5; i++)
    dht11_dat = read_dht11_dat();
 
  pinMode(DHT11_PIN,OUTPUT);
  digitalWrite(DHT11_PIN,HIGH);
 
  byte dht11_check_sum = dht11_dat[0]+dht11_dat[1]+dht11_dat[2]+dht11_dat[3];
  // check check_sum
  if(dht11_dat[4]!= dht11_check_sum)
  {
    Serial.println("DHT11 checksum error");
  }
  humdity=((float)(dht11_dat[0]*256+dht11_dat[1]))/10;
  temperature=((float)(dht11_dat[2]*256+dht11_dat[3]))/10;
  Serial.print("Current humdity = ");
  Serial.print(humdity,1);
  Serial.print("%  ");
  Serial.print("temperature = ");
  Serial.print(temperature,1);
  Serial.println("C  ");
  delay(2000);
}

And it works perfectly with my arduino duemilanove. My question is: whi they declare #define DHT11_PIN 14  for analog pin 0 and not #define DHT11_PIN 0?
The same code does not work on a mega. Is it possible that on the uno the pin A0 has many names?
13  Using Arduino / Networking, Protocols, and Devices / Re: mega 2560 and SPI on: October 24, 2012, 04:41:02 am
thanks! Do you know if there is a way with to use also the i2c with a shiled made for the UNO? (I know on the uno are pin 4 and 5 for the mega 20 and 21)
14  Using Arduino / Networking, Protocols, and Devices / mega 2560 and SPI on: October 24, 2012, 03:27:51 am
I am using th eethernet shiled on the mega without problems. But reading the documentation I get surprised that things work. If the SPI on the mega is on pins  50 (MISO), 51 (MOSI), 52 (SCK) and 53 (SS) how is possible that we can use one shield made for the UNO SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK)?
15  Using Arduino / Programming Questions / Re: programming error...Need Help!! on: October 24, 2012, 03:12:42 am
have you put libraries in the right place?
Pages: [1] 2 3 ... 14