Show Posts
Pages: [1] 2 3 ... 22
1  Using Arduino / Programming Questions / Re: NewSoftSerial.h errors on: July 25, 2014, 03:04:00 pm
Quote
Try using the SoftwareSerial library that is installed with the Arduino IDE

Thanks for the tip. I changed the instances of NewSoftSerial to SoftwareSerial in the sketch and the SSerial2Mobile library and that did clear up the errors I was getting. I also found #include <SoftwareSerial.h> commented out in the SSerial2Mobule.cpp file and uncommented that.

The errors I'm getting now seem minor but nonrtheless they are errors:
Quote
C:\Users\Scott Shirts\Documents\Arduino\libraries\SSerial2Mobile\SSerial2Mobile.cpp:45: error: expected initializer before 'SSerial2Mobile'
C:\Users\Scott Shirts\Documents\Arduino\libraries\SSerial2Mobile\SSerial2Mobile.cpp: In member function 'void SSerial2Mobile::sendTxt(const char*, const char*)':
C:\Users\Scott Shirts\Documents\Arduino\libraries\SSerial2Mobile\SSerial2Mobile.cpp:86: error: 'BYTE' was not declared in this scope
C:\Users\Scott Shirts\Documents\Arduino\libraries\SSerial2Mobile\SSerial2Mobile.cpp: In member function 'void SSerial2Mobile::sendEmail(const char*, const char*)':
C:\Users\Scott Shirts\Documents\Arduino\libraries\SSerial2Mobile\SSerial2Mobile.cpp:104: error: 'BYTE' was not declared in this scope

Near the top of the SSerial2Mobile.cpp file below, I added BYTE as a global variable first with a type byte and the as a char. Neither worked. Any advice?

Code:
/*
  SSerial2Mobile.cpp - Software serial to Mobile phone library
  Copyright (c) 2008 Gustav von Roth.  All right reserved.
  SSerial2Mobile@vonroth.com

    This program is free software: you can redistribute it and/or modify
 uy(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);nder the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

// #$Id: SSerial2Mobile.cpp,v 1.6 2009/05/04 23:40:05 gvonroth Exp gvonroth $

//this is only here to grab the constant for BYTE which is 0
#include "HardwareSerial.h"

#include "Arduino.h"

#include "ATT.h"
#include "MOT-C168i.h"

//extern "C" {
#include <SoftwareSerial.h>
//}

#include "SSerial2Mobile.h"

// some global vars for reciving data
#define BUFFSIZ 90 // plenty big
char buffer[BUFFSIZ];
char *parseptr;
char buffidx;

 
SSerial2Mobile::SSerial2Mobile(int rx, int tx): _sSerial(rx, tx)
{
  pinMode(rx, INPUT);
          pinMode(tx, OUTPUT);

_sSerial.begin(PHONE_SERIAL_SPEED);delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);

}

void SSerial2Mobile::println(const char c[])
{
_sSerial.println(c);
}

void SSerial2Mobile::off(void)
{
println(PHONE_TURN_OFF_COMMAND);
}

void SSerial2Mobile::on(void)
{
        println(PHONE_TURN_ON_COMMAND);
}

void SSerial2Mobile::reset(void)
{
        println(PHONE_RESET_COMMAND);delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
}

void SSerial2Mobile::sendTxt(const char number[],const char msg[])
{
_sSerial.println(PHONE_SET_SMS_TXT_MODE_COMMAND);
delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
_sSerial.print(PHONE_SEND_MSG);
_sSerial.print("\"");
_sSerial.print(number);
_sSerial.print("\"");
_sSerial.println();
delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
_sSerial.print(msg);
// dec 26 is a <CTRL Z>
_sSerial.println(26, BYTE);
delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
}

void SSerial2Mobile::sendEmail(const char emailAddr[],const char msg[])
{
        _sSerial.println(PHONE_SET_SMS_TXT_MODE_COMMAND);
        delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
        _sSerial.print(PHONE_SEND_MSG);
        _sSerial.print("\"");
        _sSerial.print(CARRIER_EMAIL_GATEWAY_NUMBER);
        _sSerial.print("\"");
        _sSerial.println();
        delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
_sSerial.print(emailAddr);
_sSerial.print(" ");
        _sSerial.print(msg);
        // dec 26 is a <CTRL Z>
        _sSerial.println(26, BYTE);
delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
}

//############     Stuff relating to reciving  ##########################

int SSerial2Mobile::isOK() {
     _sSerial.println("AT");
     delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
     return wait4OK();
}

int SSerial2Mobile::wait4OK() {
  int returnVal=0;
 
  while(_sSerial.available())  {
       readline();
       if (strncmp(buffer, "OK",2) == 0) {
          returnVal=1;
       } else  {
returnVal=-1;
       }
  }
        return returnVal;
}


int SSerial2Mobile::batt() {
 _sSerial.flush();
  _sSerial.println(PHONE_BATT_CHARGE_CHECK_COMMAND);
  delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
  while(_sSerial.available())  {
       readline();
       if (strncmp(buffer, "+CBC: ",6) == 0) {
         parseptr = buffer;
         parseptr = strchr(parseptr, ',') + 1;
         return parsedecimal(parseptr);
       }
  }
  return -2;
}


int SSerial2Mobile::rssi() {
  _sSerial.println(PHONE_SIGNAL_STRENGTH_CHECK_COMMAND);
  delay(PHONE_DELAY_AFTER_SENDING_COMMAND_VALUE);
  while(_sSerial.available())  {
       readline();
       if (strncmp(buffer, "+CSQ: ,",6) == 0) {
         parseptr = buffer;
         parseptr = strchr(parseptr, ' ') + 1;
         return parsedecimal(parseptr);
       }
  }
  return -2;
}



void SSerial2Mobile::readline(void) {
  char c;
 
  buffidx = 0; // start at begninning
  while (1) {
      c=_sSerial.read();
      if (c == -1)
        continue;
     // Serial.print(c);
      if (c == '\n')
        continue;
      if ((buffidx == BUFFSIZ-1) || (c == '\r')) {
        buffer[buffidx] = 0;
        return;
      }
      buffer[buffidx++]= c;
  }
}

uint32_t SSerial2Mobile::parsedecimal(char *str) {
  uint32_t d = 0;
 
  while (str[0] != 0) {
   if ((str[0] > '9') || (str[0] < '0'))
     return d;
   d *= 10;
   d += str[0] - '0';
   str++;
  }
  return d;
}

- Scotty
2  Using Arduino / Programming Questions / Re: NewSoftSerial.h errors on: July 25, 2014, 02:03:34 pm
SSerial2Mobile.h:

Code:
/*
  SSerial2Mobile.h - Software serial to Mobile phone library   
  Copyright (c) 2008 Gustav von Roth.  All right reserved.
  SSerial2Mobile@vonroth.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

// #$Id: SSerial2Mobile.h,v 1.3 2009/05/04 23:32:23 gvonroth Exp $

#ifndef SSerial2Mobile_h
#define SSerial2Mobile_h
 
//#include "WConstants.h"
#include "Arduino.h"
#include <NewSoftSerial.h>

 
class SSerial2Mobile {
 
     public:
           SSerial2Mobile(int rx, int tx);
           void println(const char[]);
           void off(void);
   void on(void);
   void reset(void);
   void sendTxt(const char number[],const char msg[]);
   void sendEmail(const char emailAddr[],const char msg[]);

           int isOK();
           int wait4OK();
           int batt();
           int rssi();

     private:
           NewSoftSerial _sSerial;
           void readline(void);
           uint32_t parsedecimal(char *str);
     
};
 
#endif

3  Using Arduino / Programming Questions / NewSoftSerial.h errors on: July 25, 2014, 12:26:35 pm
Hello all. I'm working on a project to send a text message from a cell phone that has a serial connection, using an arduino Nano. I'm getting error messages referencing to NewSoftSerial library I'm using. The sketch follows:

Code:
/*
 Example of SSerial2Mobile libary

Sends a SMS and an email
The SMS phone number and the email address need to be changed to something valid.

 created Jan 2010
 by Gustav von Roth
*/

#include <NewSoftSerial.h>
#include <SSerial2Mobile.h>

#define RXpin 10
#define TXpin 11 //blue

int returnVal=10;






void setup() {
  Serial.begin(9600);
  SSerial2Mobile phone = SSerial2Mobile(RXpin,TXpin);
 
 

  //returnVal=phone.isOK();
  //Serial.println(returnVal, DEC);
  //delay(3000);
 
  Serial.print("Batt: ");
  Serial.print(phone.batt());
  Serial.println("%");
 
  Serial.print("RSSI: ");
  Serial.println(phone.rssi());
  // Any RSSI over >=5 should be fine for SMS
  // SMS:  5
  // voice:  10
  // data:  20
 
  phone.sendTxt("+12125550125","Lib SMS Test1");
  delay(3000);
  phone.sendEmail("SSerial2Moble@example.com", "Lib email test1");
  delay(3000);
 
 
 
}
void loop(){}

The library file is:
Code:
/*
NewSoftSerial.h - Multi-instance software serial library
Copyright (c) 2006 David A. Mellis.  All rights reserved.
-- Interrupt-driven receive and other improvements by ladyada
-- Tuning, circular buffer, derivation from class Print,
   multi-instance support, porting to 8MHz processors,
   various optimizations, PROGMEM delay tables, inverse logic and
   direct port writing by Mikal Hart

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

The latest version of this library can always be found at
http://arduiniana.org.
*/

#ifndef NewSoftSerial_h
#define NewSoftSerial_h

#include <inttypes.h>
#include "Print.h"

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

#define _NewSS_MAX_RX_BUFF 64 // RX buffer size
#define _NewSS_VERSION 10 // software version of this library
#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif

class NewSoftSerial : public Print
{
private:
  // per object data
  uint8_t _receivePin;
  uint8_t _receiveBitMask;
  volatile uint8_t *_receivePortRegister;
  uint8_t _transmitBitMask;
  volatile uint8_t *_transmitPortRegister;

  uint16_t _rx_delay_centering;
  uint16_t _rx_delay_intrabit;
  uint16_t _rx_delay_stopbit;
  uint16_t _tx_delay;

  uint16_t _buffer_overflow:1;
  uint16_t _inverse_logic:1;

  // static data
  static char _receive_buffer[_NewSS_MAX_RX_BUFF];
  static volatile uint8_t _receive_buffer_tail;
  static volatile uint8_t _receive_buffer_head;
  static NewSoftSerial *active_object;

  // private methods
  void recv();
  bool activate();
  virtual void write(uint8_t byte);
  uint8_t rx_pin_read();
  void tx_pin_write(uint8_t pin_state);
  void setTX(uint8_t transmitPin);
  void setRX(uint8_t receivePin);

  // private static method for timing
  static inline void tunedDelay(uint16_t delay);

public:
  // public methods
  NewSoftSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false);
  ~NewSoftSerial();
  void begin(long speed);
  void end();
  int read();
  uint8_t available(void);
  bool active() { return this == active_object; }
  bool overflow() { bool ret = _buffer_overflow; _buffer_overflow = false; return ret; }
  static int library_version() { return _NewSS_VERSION; }
  static void enable_timer0(bool enable);
  void flush();

  // public only for easy access by interrupt handlers
  static inline void handle_interrupt();
};

// Arduino 0012 workaround
#undef int
#undef char
#undef long
#undef byte
#undef float
#undef abs
#undef round

#endif

The error messages are:
Quote
In file included from SSerial2Mobile_Example1.pde:11:
C:\Users\Scott Shirts\Documents\Arduino\libraries\NewSoftSerial/NewSoftSerial.h:71: error: conflicting return type specified for 'virtual void NewSoftSerial::write(uint8_t)'
C:\Downloads\Arduino\arduino-1.0.5-windows\arduino-1.0.5\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'

Since I don't really understand the error messages I've attempted to change things (such as remove 'virtual') in line 71 of the library file, but nothing I've tried works and at times aggravated the messages. I'd appreciate help in resolving the error messages and would like to understand why they are compiling errors.

Thanks - Scotty
4  Using Arduino / Programming Questions / Re: How can do something like this: IF HIGH && > 3000ms on: July 22, 2014, 06:47:37 am
Couldn't pulseIn be used? - Scotty
5  Using Arduino / Programming Questions / Re: Reading Car signals on: June 20, 2014, 06:18:17 am
How would one know how much fuel is passing through the injector per a time interval? - Scotty
6  Using Arduino / General Electronics / Re: Source for hookup wire on: June 06, 2014, 03:12:16 pm
Quote
How about rainbow colored ribbon cable? That's 26 guage.

Yes that would be good to use if there wasn't so much extra clear coating on it that I suppose is used to keep all the conductors together. The last time I used it I could not insert the insulation into a pin for a Dupont connector without shaving all the extra junk off of it. Perhaps there is some that does not have the extra coating? That kind of flexibility, like separate conductors of a ribbon cable, is what I'm looking for.

Quote
I use network and phone cable for most of my work.

Yeah, that what's I'm using now. Just don't like it.

Quote
Kinda like this, but with more cores: http://www.ebay.com/itm/221401540537

For the kind of cable I'm looking for, those loose conductors would be drooping over.


Nonetheless, thanks to you all for responding. - Scotty
7  Using Arduino / General Electronics / Source for hookup wire on: June 06, 2014, 11:27:53 am
Hello All. I'm seeking a source of stranded hook up wire, 28 or 26 gauge to use for signal or low current power (leds, etc.) that takes solder well. I want very flexible wire that is flexible enough to droop when laid across a finger like cooked spaghetti. Ideally, I would like to find cable that would contain multiple conductors of different colors so I could strip away the sheathing and use the conductors within. That would save having to buy lengths of different colored individual wire. Any leads? Thanks - Scotty
8  Using Arduino / Motors, Mechanics, and Power / Re: Controllin a motor brushless by RF 433mhz on: May 29, 2014, 07:24:34 am
Please post your final code. - Scotty
9  Using Arduino / Motors, Mechanics, and Power / Re: Motor for very slow rotation on: May 28, 2014, 06:49:18 am
This may be a solution. - Scotty
10  Using Arduino / Project Guidance / Re: Servo on: May 21, 2014, 07:06:08 am
You may want to consider using a different motor. There are many high torque, inexpensive, small dc gear motors available to use in lieu of a pricey high torque servo. - Scotty
11  Using Arduino / Project Guidance / Re: how to interface RF433mhz modules to arduino on: May 21, 2014, 06:59:01 am
A guy named Google can help you. Ask him to search "433mhz Arduino". - Scotty
12  Using Arduino / Programming Questions / Re: Sending data between two nRF24l01 units (wireless altimeter for RC plane) on: May 19, 2014, 02:33:56 pm
Thank You. Looking forward to it. - Scotty
13  Using Arduino / Programming Questions / Re: programming mess up! on: May 18, 2014, 06:09:10 am
SoftwareServo.h, SoftwareSerial.h & VirtualWire.h are libraries. Do you have them installed in your libraries folder? - Scotty
14  Using Arduino / Motors, Mechanics, and Power / Re: Arduino Car window on: May 12, 2014, 06:51:56 am
Quote
And yes when window will be fully closed then voltage will be incresed then i will made the code when voltae is bigger then 12v then arduino stop relay

The current, not the voltage will increase. - Scotty
15  Using Arduino / Motors, Mechanics, and Power / Re: Arduino Car window on: May 11, 2014, 07:45:49 am
Automotive window regulator motors will require a significant amount of current to run the window up or down. The amount of current will increase GREATLY when the window reaches top or bottom and the motor stalls. You might want to consider that. - Scotty
Pages: [1] 2 3 ... 22