Show Posts
Pages: [1] 2 3 ... 22
1  Using Arduino / Programming Questions / Re: Using the 2x16 LCD to control things on: September 24, 2014, 01:32:07 pm
Quote
I don't know how to get the count to not go over 4 and bellow 0
http://arduino.cc/en/reference/constrain

- Scotty
2  Using Arduino / Programming Questions / Re: Define an output dependent on two conditions being met? on: September 24, 2014, 06:23:31 am
I would use two boolean variables such as 'sensor_A_value_met' and 'sensor_B_value_met'. Program so that when the value of a sensor has reached a threshold, set the respective boolean variable to TRUE. If both boolean variables are TRUE, turn on led and mark the time (millis). Keep checking the time. When the difference between the current time and the time marked when the two boolean values went TRUE is equal to or greater than 'pause', turn the led off and set the two boolean values to FALSE.

- Scotty
3  Using Arduino / Programming Questions / Re: Using the 2x16 LCD to control things on: September 24, 2014, 06:05:44 am
Use a variable to hold an integer value; perhaps call it Count. Program so that Count increments or decrements depending on the change of state of the up and down push buttons. Depending on the value of Count, display certain text. For example: If Count is 2, display: "Push 'on' button for led 2". Program so that if Count is 2 & 'on' push button is depressed, drive the pin that led 2 is connected to to an on (dependent on how you have your led wired) condition. Else, drive it to an off condition.

Quote
I can display text on the LCD, how does the arduino know what you are selecting on the LCD? so if there is a list of 5 different LED's to select from how does it know which one you have chosen?
By knowing the value of Count.
- Scotty
4  Using Arduino / General Electronics / Re: TLC5916 questions on: September 16, 2014, 07:02:55 am
This device seems similar to the TLC5940. I have come across some detailed youtube videos on it's operation. - Scotty
5  Using Arduino / Motors, Mechanics, and Power / Re: Electric Braking a scooter motor... on: September 14, 2014, 07:04:49 am
What  rmetzner49 alludes to here is removing power from the motor and placing a load across the motor's terminal, allowing the motor to act as a generator and the load will slow the generator. Also alluded to is regenerative braking where by the 'load' across the motor is eventually the battery, charging it. - Scotty 
6  Using Arduino / Project Guidance / Re: 20-30 digital buttons on one board on: September 09, 2014, 07:01:23 am
Can't use this method? - Scotty
7  Using Arduino / General Electronics / Re: PCB manufacture - trouble aligning artwork on: September 09, 2014, 06:51:43 am
I doubt it's the printer since a printer is capable of placing a dot of ink on a previously printed dot in exactly the same dot location. Try printing on paper and check alignment. - Scotty
8  Using Arduino / Project Guidance / Re: Robot arm for PCB etching on: September 01, 2014, 07:44:14 am
Is it practical/feasible to rotate the tanks and raise/lower the PCBs? - Scotty
9  Using Arduino / General Electronics / Re: Opto coupler wiring basic on: August 05, 2014, 06:30:48 am
Wouldn't a voltage divider work? - Scotty
10  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
11  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

12  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
13  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
14  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
15  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
Pages: [1] 2 3 ... 22