Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Bug using NewSoftSerial & Servo.h together on: January 14, 2010, 10:07:02 am
Hello all, I am having the same problem described.  Can someone please tell me where I can get the servo 0016 library?  I can't seem to find it anywhere.  Thanks a lot!
2  Forum 2005-2010 (read only) / Syntax & Programs / Arduino frequency input help for tone detector on: March 15, 2010, 12:11:47 pm
I could use some help setting the arduino's sampling frequency.

Here's what I'm trying to do.  I want to use the arduino to detect a tone at 18 kHz, and output a tone at 8 kHz when it detects the 18 kHz tone.  The trick is that I want to do this using aliasing.  I need to set the sampling frequency of the arduino to be approximately 26 kHz so that when it tries to detect the 18 kHz tone, the arduino will think the tone is at 8 kHz due to aliasing.

My plan is to use a fft to get the frequency of the tone (should be 8 kHz), and then use that frequency to generate a tone.  I haven't picked out a specific microphone or speaker yet, so if you had any suggestions for those, that would be great.

So, to reiterate, could you help me set the sampling frequency of an arduino duemilanove?  Thanks a lot, gang!
3  Forum 2005-2010 (read only) / Interfacing / SM5100B trouble finding <CR> on: January 18, 2011, 07:18:16 pm
Hello everyone,

I'm having an issue parsing a response from the SM5100B and finding a carriage return.  Currently, I set the module to notify me of a new SMS (AT+CNMI=3,3,0,0).  According to the documentation: (page 72 of 141, PDF)

there is a carriage return right before the text of the SMS.  When my ParseResp() function is run, it can't find a carriage return.

I know my ParseResp() code works because I tested it by looking for a different character.  For instance, I told it to look for a "&", and then a put a "&" at the beginning of my SMS to the module.  Obviously this is a quick fix for the problem, and I could just start all my SMSs with a "&", but I would rather fix the issue than skirt around it.

Here is all my code:
/*  There is an issue here with digitalRead and digitalWrite.
    When I send pin 8 HIGH, pin 7 reads as HIGH for some reason.

#include <NewSoftSerial.h>  
#include <string.h>        
#define BUFFSIZE 512

char ATBuff[BUFFSIZE];
String SMSBuff = "";
String Mess = "";
int CELL_REG = 0;
int CELL_AT = 0;
//int CELL_SMSMODE = 0;
int nBufPos;
int dataReady = 0;
int noCR = 0;
NewSoftSerial cell(2,3);

void setup()
  Serial.println("Starting Serial");
  pinMode(7,INPUT); //get rid of this
  while(CELL_REG == 0 || CELL_AT == 0){
  Serial.println("Found Network");
  /*   Sends SMS
  cell.print("'IT WORKS!!!!!'");

void loop() {
  //This loop exists to delete SMSs while the code is running
  if (digitalRead(7)==HIGH){
    Serial.println("SMSs deleted.");
  //This loop exists to look for incoming data from the sm5100b
  //   If it finds data, it parses it and decides what to do
  dataReady = cell.available();
  if (dataReady > 0){
    //Serial.println("data available");
    dataReady = 0;


// This function gets commands from the sm5100b
void ATGetResp(void) {
    char c;
    memset(ATBuff, '\0', BUFFSIZE);                // clear array
    nBufPos = 0;                                   // Reset array counter
    int nBytes = 0;                                
    nBytes = cell.available();                     // Store number of bytes in serial queue
    if (nBytes > 0) {
      for (int i = 1; i <= nBytes; i++) {          // Keep running loop till no more bytes in queue
        if (nBufPos == BUFFSIZE - 3) {             // Stop if array is full
          nBufPos = 0;
        c =;                           // Set c to current serial character
        if (c == '\r') {                           // If c is carriage return
            ATBuff[nBufPos] = c;                   //   add it to the array
            c =;                       // Doesnt work without this line, can anyone explain why?
            if (c == '\n') {                       // If c is newline
              ATBuff[nBufPos] = c;                 //   add to array
              ATBuff[nBufPos+1] = '\0';            //   and terminate
              return;                              //   then return to program
        ATBuff[nBufPos] = c;
    ATBuff[nBufPos] = '\0';

//This function parses the intial responses from the sm5100b
//   to make sure everything is operating correctly
void ATParse(void){
  if (strstr(ATBuff, "+SIND: 11") != 0) {
    CELL_REG = 1;
  if (strstr(ATBuff, "+SIND: 4") != 0) {
    CELL_AT = 1;

//This function sets the sm5100b to TEXT mode and waits
//  for error free response
void SetText(void){
  int isText = 0;
    if (strstr(ATBuff,"OK") !=0){
      isText = 1;
      Serial.println("Text is go");

//This function sets the sm5100b to notify when it
//   receives an SMS and waits for an error free response
void SetNotify(void){
  int isNotify = 0;
    if (strstr(ATBuff,"OK") !=0){
      isNotify = 1;
      Serial.println("Notify is go");

//This function parses the data that is received after
//   the sm5100b is set up correctly.  Right now it just
//   looks for SMS and attempts to parse the response to
//   pull out the actual message
//   NOTE to me:  issue with noCR, should be resolved
//   with <CR> issue
void ParseResp()
  if (strstr(ATBuff,"+CMT:") !=0 || noCR == 1){
    String SMSBuff = ATBuff;
    if (SMSBuff.indexOf('\r') != -1){   //found CR '\r'  tried dice
      for(int j = SMSBuff.indexOf('\r')+1; j<=SMSBuff.length(); j++){
        Mess += SMSBuff[j];
        noCR = 0;
    Serial.print("The message is: ");
    else{      //no <CR>
      noCR = 1;
      Serial.println("No <CR> found :(");

NOTE:  I took the ATGetResp() code from user Philherup.

My question for anyone out there is:  Why can't I find the carriage return?  What am I missing and/or doing wrong?


4  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + LMB0820 LCD on: December 20, 2009, 08:04:27 pm

I am having the same problem that you expressed with the LMB0820, where the black spot on the back is getting extremely hot.  Were you able to fix the problem?  I would appreciate any help that you can give.  Thanks!
Pages: [1]