Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 13
121  Development / Other Software Development / Re: Trouble writing a library on: February 19, 2012, 05:48:18 pm
Quote
If you use Arduino 1.0 you should use something like:

#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif

I recall that using libraries in a library on the Arduino platform have some issues. Think you have to include
#include <SHT1x.h>
#include <math.h>
in your main sketch too.

Hope this helpes.


I am using 022 until I hear all the libraries are sorted out.
Putting includes in main sketch no help!
jim
122  Development / Other Software Development / Re: Trouble writing a library on: February 19, 2012, 04:51:42 pm

you can post the code of your libs and sample code.

A better place to put your libraries is in your code folder/libraries, see FILE-> preferences for the location.

Are you shure you killed all instances of the IDE?




I rebooted the computer!

h file

#######################
# This is keywords for THMOD library
#######################
#infdef THMOD_H
#define THMOD_H
#include <WProgram.h>

class THMOD
public:
{
   THMOD();
   ~THMOD();
   float readC();
   float readF();
   float readH();
}
#endif

keyword file

#######################
# Datatypes (KEYWORD 1)
#######################

#######################
# Methods (KEYWORD2)
#######################
THMOD KEYWORD1
readC KEYWORD2
readF KEYWORD2
readH KEYWORD2

cpp file

/* this is an attempt to learn how to write libraries
by putting a wrapper around the SHT1x library
with shorter names*/
#include <SHT1x.h>
#include <math.h>
#include "THMOD.h" // include declaration

#define dataPin  4   // DATA
#define clockPin 5   // SCK
 float temp_c;
 float temp_f;  float humidity;

 //constructor
THMOD::THMOD()
{
   SHT1x sht1x(dataPin, clockPin);
}
//destructor
THMOD::~THMOD() // nothing needed

float THMOD::readC()
{
    temp_c = sht1x.readTemperatureC();
    return temp_c;
}

float THMOD::readF()
{
    temp_f = sht1x.readTemperatureF();
    return temp_f;
}

float THMOD::readH()
{
    humidity = sht1x.readHumidity();
    return humidity;
}

All this does is give me easier names because my right arm is amputated and typing with just your left hand is not easy.
Jim
 
123  Development / Other Software Development / Trouble writing a library on: February 19, 2012, 04:30:34 pm
I attempting to learn how to write libraries. It is just to learn and doesn't do much.
I have written a keyword  file. a .cpp file and a .h file all with the name THMOD.(H/txt/cpp). I put the three files in a directory arduino/library/THMOD. To test, I closed Arduino and re-opened it, and I created a sketch with just the line "#include "THMOD.H".  I get the message "sketch_feb19a.cpp:1:19: error: THMOD.H: No such file or directory". Do I need to compile the ccp file to a .o file and if so, with what program?
Jim
124  Using Arduino / Networking, Protocols, and Devices / Re: Both APC220 and Ethernet on a Mega 1280 on: February 10, 2012, 12:04:12 pm
Quote
What I am wondering is if you can make either shield easily communicate with serial 2 instead of serial 1 so they are not trying to talk on the same port with both shields, and if so, how? I have not received either shield yet but suspect this might be an issue.
The Ethernet shield does not use serial at all, so this is NOT going to be an issue. It uses the SPI pins (via the 6 pin ICSP header on the bottom of the ethernet shield/top of the Mega).

Thanks PaulS, this is great, this makes my project doable.

Jim
125  Using Arduino / Networking, Protocols, and Devices / Both APC220 and Ethernet on a Mega 1280 on: February 08, 2012, 10:15:53 pm
I posted this on "Project Guidance" but got no responses. I realized this might be the proper forum.

I have multiple Arduinos with sensors in various locations, communicating with APC220 RF modules. I want to connect Pachtube to all of them. My plan is to use a mega 1280 with a

http://www.ebay.com/itm/New-SainSmart-Sensor-Shield-V5-4-Arduino-APC220-Bluetooth-Analog-Module-Servo-/260928323943?pt=BI_Electrical_Equipment_Tools&hash=item3cc08a4167'

to connect the APC 220 and collect data from my sensors and a

http://www.ebay.com/itm/W5100-Ethernet-Shield-for-Arduino-Laterest-Version-micro-SD-Card-PoE-Ready-00930-/110819574126?pt=LH_DefaultDomain_0&hash=item19cd5c816e

to connect the W5100 and thus to my router. What I am wondering is if you can make either shield easily communicate with serial 2 instead of serial 1 so they are not trying to talk on the same port with both shields, and if so, how? I have not received either shield yet but suspect this might be an issue.
Jim
126  Using Arduino / Project Guidance / Re: Connecting both an APC 220 and W5100 to a Mega 1280 on: February 07, 2012, 11:46:13 am
Based on the underwhelming number of replies, I'll assume there is no easy way. I've thought of a possible solution, I'll try it out.
Jim
127  Using Arduino / Project Guidance / Connecting both an APC 220 and W5100 to a Mega 1280 on: February 05, 2012, 03:58:15 pm
I have multiple Arduinos with sensors in various locations, communicating with APC220 RF modules. I want to connect Pachtube to all of them. My plan is to use a mega 1280 with a

http://www.ebay.com/itm/New-SainSmart-Sensor-Shield-V5-4-Arduino-APC220-Bluetooth-Analog-Module-Servo-/260928323943?pt=BI_Electrical_Equipment_Tools&hash=item3cc08a4167'

to connect the APC 220 and collect data from my sensors and a

http://www.ebay.com/itm/W5100-Ethernet-Shield-for-Arduino-Laterest-Version-micro-SD-Card-PoE-Ready-00930-/110819574126?pt=LH_DefaultDomain_0&hash=item19cd5c816e

to connect the W5100 and thus to my router. What I am wondering is if you can make either shield easily communicate with serial 2 instead of serial 1 so they are not trying to talk on the same port with both shields, and if so, how?
Jim
128  Using Arduino / Project Guidance / Looking for part: 16 bit I2C ADC on: January 05, 2012, 10:32:03 pm
I have a need to measure and log some DC voltages very accurately. I'm monitoring and logging a process that is very fussy. Somewhere recently I saw something in this forum about a 16 bit ADC that communicated through a I2C interface, but now I can't find it. I can't remember if it was on a shield or just a chip. If it's a chip I will make a shield using it. Does anyone here know what device I saw, or something similar?

Jim
129  Community / Bar Sport / Re: How far would you be will to travel for a "local" electronics hobbyist shop? on: December 18, 2011, 10:09:19 pm
I live 2 hours uphill, over 2-11,000 foot passes, of Denver on a good day, 5 on a snowy winter day. Internet or RS are my only choices.

Jim
130  Using Arduino / Networking, Protocols, and Devices / Re: Wireless RF APC220 on: December 17, 2011, 02:40:18 pm
I have been using this protocol with APC220, for some time. It work great over distance of 80 feet through 2 walls.

Jim
131  Using Arduino / Programming Questions / Re: Strange result SOLVED on: November 23, 2011, 02:06:08 pm
Thanks, Robtillart you were spot on! PaulS you are correct! I a noob at this, as probably is evident in my code, but I hope I will remember your comment, as it sure makes sense.

Jim
132  Using Arduino / Programming Questions / Strange result on: November 23, 2011, 01:17:18 pm
I trying to create a remote temperature sensor with ability to turn on a heater and fan remotely. I wrote this sketch for the heater side:

Quote
#include <SHT1x.h>
#include <math.h>

#define dataPin  10   // DATA
#define clockPin 11   // SCK
  int val = 0;
  float temp_c;
  float temp_f;
  float humidity;
  int heater = 8;
  int fan = 9;
  SHT1x sht1x(dataPin, clockPin);


void setup()
{
   Serial.begin(9600);
}

void loop()
{
  temp_c = sht1x.readTemperatureC();
  temp_f = sht1x.readTemperatureF();
  humidity = sht1x.readHumidity();
   // send data only when you receive an A:
 if (Serial.available() > 0)
 {
     val = Serial.read();
     if (val == 10)
     {
     }
     else if (val == 13)
     {
     }   
     else if (val == 65)
     {
         Serial.print("Temperature: ");
         Serial.print(temp_f, 2);
         Serial.print("F");
         Serial.print("Humidity: ");
         Serial.print(humidity);
         Serial.println("%");
     }
     else if (val == 66)
     {
         digitalWrite(heater, LOW);
         Serial.println (val, DEC);
     }
     else if (val == 67)
     {
        digitalWrite(heater, HIGH);
   Serial.println (val, DEC);
     }
    else if (val == 68)
    {
        digitalWrite(fan, HIGH);
   Serial.println (val, DEC);
    }
    else if (val == 69)
    {
        digitalWrite(fan, LOW);
   Serial.println (val, DEC);
    }
 }
}

 I entered A [enter], B  [enter], C  [enter]D  [enter] E [enter]. I got the result:


Quote
Temperature: 66.34FHumidity: 29.52%
66
67
68
69

but the relays did not toggle. So to test  them I wrote:

Quote
int relay1 = 8;
int relay2 = 9;

void setup()
{
  Serial.begin(9600);
  pinMode (relay1, OUTPUT);
  pinMode (relay2, OUTPUT);
}
void loop()
{
  digitalWrite ( relay1, LOW);
  Serial.print ("1Low");
  delay (1000);
  digitalWrite ( relay1, HIGH);
  Serial.print ("1High");
  delay (1000);
  digitalWrite ( relay2, LOW);
  Serial.print ("2Low");
  delay (1000);
  digitalWrite ( relay2, HIGH);
  Serial.print ("2High");
  delay (1000);
 
}

and it works as expected, toggling the relays. Why doesn't my first sketch work as expected?

Jim
133  Using Arduino / Project Guidance / Re: Displaying serial data from a apc220 on a lcd PARTIALLY SOLVED on: November 17, 2011, 04:06:20 pm
Found this solution on Internet.

{
  int i=0;
 if(Serial.available())
   {
     delay(100);
     while( Serial.available() && i< 99)
     {
        message[i++] = Serial.read();
     }
   } 
     message[i++]='\0';
  lcd.print(message);
}

works great!
Unfortunately the temperature is a float and has too many digits and overruns the line. is there an easy to truncate a float to 1 digit after the decimal point? I think the while statement above can be modified to work but I am not sure how.

Jim
134  Using Arduino / Project Guidance / Displaying serial data from a apc220 on a lcd on: November 16, 2011, 08:57:12 pm
I'm trying to monitor the temperature in one building from another building 65 feet( about 20 meters) away. i am using 2 apc220s. I want to use an Arduino on the receiving end and possibly be able to switch a heater off/on as  well. At present I have one Arduino monitoring the temperature and can read it in the other building reliably on a PC. However every attempt to display the data using an LCD on another Arduino with the apc220 I have made has failed to compile. I am new to programming so this may simply be my ignorance. The message I transmitting is "Temperature is XX degrees F, The humidity is YY%". I have a 20X4 LCD, connecting via I2C.

Jim
135  Using Arduino / Programming Questions / Re: trying tolearn case on: November 10, 2011, 08:31:58 pm
Thanks guys, I got everything working with "else if" but I thought it would be clearer with "switch-case". Looking at your sample I can see that this is definitely true.

Jim
Pages: 1 ... 7 8 [9] 10 11 ... 13