Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 05:10:50 pm
Thanks.  I thought the short line length was a limitation of the IDE but it was a limitation of the programmer.  I have modified the sketch and it works as I  need
2  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 12:57:57 pm
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

// nRF24L01(+) radio attached using Getting Started board
RF24 radio(9,10);

// Network uses that radio
RF24Network network(radio);

// Address of our node
const uint16_t this_node = 0;

// Address of the other node
const uint16_t other_node = 1;

// Structure of our payload
struct payload_t
{
  unsigned long ms;
  float counter;
  float room_temperature;
  float humidity;
  float counter1;
  float room_temperature1;
  float humidity1;
  float humidity2;

};
// ***************************************************************
float temperature_measurement(int pin)
{
  analogReference(INTERNAL);
  float Temperature = 0;
  float avtempRead  = 0;
  for (int i = 1 ; i< 101 ; i++ ){
    delay (10);
    avtempRead   +=  analogRead(pin)*(112000.00/1023.00/1.176) ;
  }
  Temperature = avtempRead / 100000.00 ; 
  return Temperature;
}
//*****************************************************************

void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx_item_humidity/");
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
  radio.printDetails();
}

void loop(void)
{

  // Pump the network regularly
  network.update();
  unsigned long ms;
  float counter;
  float room_temperature;
  float humidity;
  float counter1;
  float room_temperature1;
  float humidity1;
  float humidity2;

  // Is there anything ready for us?
  while ( network.available() )
  {
    // If so, grab it and print it out
    RF24NetworkHeader header;
    payload_t payload;
    network.read(header,&payload,sizeof(payload));

    (temperature_measurement(A1));
    Serial.print(millis()/5000);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A1),1);
    Serial.print(" ");
    Serial.print( payload.room_temperature,0);
    Serial.print(" ");
    Serial.println(payload.humidity1,0);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A2),1);
    Serial.print(" ");
    Serial.println( payload.room_temperature1,0);

   
  }
}

Here is the whole programme.  I don't understand why when I declare the names in the payload structure I have to re declare it.  So rather than find out I put it where it now is and it worked.  I should add I generated names for the data  as a trial as currently I am only reading 4 sensors..
All I want is the data to appear in a single line rather than 2 lines.  If I change the last print from println to print the data will be in continuous line and I will have to add line breaks myself.
3  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 11:23:22 am
Code:
void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx_item_humidity/");
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 94, /*node address*/ this_node);
  radio.printDetails();
}

void loop(void)
{

  // Pump the network regularly
  network.update();
  unsigned long ms;
  float counter;
  float room_temperature;
  float humidity;
  float counter1;
  float room_temperature1;
  float humidity1;
  float humidity2;

  // Is there anything ready for us?
  while ( network.available() )
  {
    // If so, grab it and print it out
    RF24NetworkHeader header;
    payload_t payload;
    network.read(header,&payload,sizeof(payload));

    (temperature_measurement(A1));
    Serial.print(millis()/5000);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A1),1);
    Serial.print(" ");
    Serial.print( payload.room_temperature,0);
    Serial.print(" ");
    Serial.println(payload.humidity1,0);
    Serial.print(" ");
    Serial.print (counter,0);
    Serial.print(" ");
    Serial.print(temperature_measurement(A2),1);
    Serial.print(" ");
    Serial.println( payload.room_temperature1,0);
tags added by moderator - click "Modify" to see how it's done.
4  Using Arduino / Programming Questions / Re: serial monitor print width on: February 12, 2014, 10:57:59 am
I am data logging from a number of sensors and then graphing using Excel.  I need each line or chain of results to be a single line to make the graph straight forward.
5  Using Arduino / Programming Questions / serial monitor print width on: February 12, 2014, 09:31:04 am
Hi I am printing to the serial monitor up to 8 groups of numbers with 2 spaces as separators.  The numbers can have up to 4 digits plus a decimal point.  a max of 54 character spaces.  The result is always 2 lines  and I want 1 line.  How do I do this?  I am using Serial.print on the 1.0.5 IDE
6  Using Arduino / Programming Questions / initializer but incomplete type error on: January 09, 2014, 06:53:29 pm
I am using 1.0.5.  I have loaded a sketch which calls a number of library programmes   I have used a similar sketch which does not throw up errors.  The sketch is sensornet an NRF24 mesh program written by maniacbug.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 */

/**
 * Example of a sensor network
 *
 * This sketch demonstrates how to use the RF24Network library to
 * manage a set of low-power sensor nodes which mostly sleep but
 * awake regularly to send readings to the base.
 *
 * The example uses TWO sensors, a 'temperature' sensor and a 'voltage'
 * sensor.
 *
 * To see the underlying frames being relayed, compile RF24Network with
 * #define SERIAL_DEBUG.
 *
 * The logical node address of each node is set in EEPROM.  The nodeconfig
 * module handles this by listening for a digit (0-9) on the serial port,
 * and writing that number to EEPROM.
 */

#include <avr/pgmspace.h>
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
#include <Tictocs.h>
#include <Button.h>
#include <TictocTimer.h>
#include "nodeconfig.h"
#include "sleep.h"
#include "S_message.h"
#include "printf.h"

// This is for git version tracking.  Safe to ignore
#ifdef VERSION_H
#include "version.h"
#else
#define __TAG__ "Unknown"
#endif

// Pin definitions
#ifndef PINS_DEFINED
#define __PLATFORM__ "Getting Started board"

// Pins for radio
const int rf_ce = 9;
const int rf_csn = 10;

// Pins for sensors
const int temp_pin = A2;
const int voltage_pin = A3;

// Pins for status LED, or '0' for no LED connected
const int led_red = 0;
const int led_yellow = 0;
const int led_green = 0;

// Button to control modes
const int button_a = 4;

// What voltage is a reading of 1023?
const unsigned voltage_reference = 5 * 256; // 5.0V
#endif


RF24Network network(radio);
This is the line which causes the error.

I cannot find any solutions to this problem  In truth I do not know what a initializer is and type is not explained in arduino reference.  Any help would be appreciated
7  Using Arduino / Networking, Protocols, and Devices / Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver on: January 04, 2014, 10:52:57 pm
Hi Guys.  I am having problems compiling Lord Maniacbug's sensornet sketch.  The problem seems to be in prinf.cpp  Where can I get an up to date copy.  It is very difficult for noobs  like me to figure out all the libraries when they are not listed on github.
On the positive side I have got 2 arduinos linked - one sending sensor data to the other.
Any help would be appreciated
8  Using Arduino / Programming Questions / Re: eeprom_update_block missing eeprom.h on: January 24, 2013, 03:39:19 pm
Thanks for your input guys.  I am really at sea here.  Help with a few lines of code to replace eeprom_update_block would be really handy.  I do not know if this is a big problem or not.
9  Using Arduino / Programming Questions / eeprom_update_block missing eeprom.h on: January 22, 2013, 11:41:31 am
It appears that the C++ instruction eeprom_update_block  is missing.  Does anybody have a work a round for this missing instruction
10  Using Arduino / Installation & Troubleshooting / Re: copying sketches to sd card on: November 26, 2012, 09:25:58 pm
I am not sure johnwasser.  I use ctrl C to copy highlighted text in the arduino IDE and then open a file and use ctrl V to copy the saved file and nothing happens.  Can you tell me what I am doing wrong as I use the same process on other text files?
11  Using Arduino / Installation & Troubleshooting / copying sketches to sd card on: November 26, 2012, 12:05:08 pm
I cant copy a sketch from the arduino IDE to say an sd card.  Anybody got a solution Please
12  Using Arduino / Interfacing w/ Software on the Computer / Re: Silverlight, Firmata and Arduino on: October 12, 2012, 10:57:22 am
Hi Andrew Read your stuff with great interest.  i have been trying to get Firmata to work without success  I was hoping to monitor arduino pins as my sketch was running but this does not seem to be possible as the firmata sketch must be loaded onto the arduino thus deleting my sketch.  Is my understanding correct?  If it is possible to monitor pins as my programme is running how do I do it?
13  Using Arduino / Installation & Troubleshooting / Re: Difficulty uploading a modification to an existing sketch on: October 16, 2011, 03:08:16 am
Thanks for the suggestion.  I have a sd card reader with a card in it.  I will try disconnecting the card reader.
14  Using Arduino / Installation & Troubleshooting / Difficulty uploading a modification to an existing sketch on: October 14, 2011, 07:00:21 pm
I have been using my nano for reading 6 voltages and sending the results to a sd card.  I am having trouble getting the IDE recognising the usb port.  The select port is greyed out.  Usually removing the cable and changing the board clears the problem but even reinstalling the IDE does not clear the problem.  I have used the same port for other usb devices without problem.  I am running Ubuntu as a OS.
Any help will be appreciated.
15  Using Arduino / Storage / Re: Interfacing SD card with nano on: October 02, 2011, 02:11:14 pm
after a lot of reading and some thinking I got the sd card to receive data.  However I tried to make a better cable connection between the nano and the card board and got it wrong.  It looks as if all is ok but I still have problems using the arduino IDE.  The serial port is greyed out.  I tried a talkback and it worked.  Should I reinstall or is there another IDE I can use?
Pages: [1] 2