Show Posts
Pages: [1] 2 3
1  Products / Arduino GSM Shield / USSD code and response on: February 17, 2014, 01:30:41 pm
How to send: AT+CUSD=1,"*121#"
And I get this response:+CUSD: 2,"Stanje na Vasem racunu je 1.00 din. Kredit mozete dopuniti do 18.06.2014. Pozovite *111# i proverite koja vas ponuda ceka.",15

I need to extract text and forward to number who sent request.
2  Using Arduino / Programming Questions / Re: eeprom default state on: February 17, 2014, 12:37:00 pm
SOLVED
I listen advice from KeithRB.
I load sketch example from arduino EEPROM_clear, and after that I load my code and everything work.
3  Using Arduino / Programming Questions / Re: eeprom default state on: February 17, 2014, 11:39:39 am
OK I can change it, but isn't this a chicken-egg problem.
If by default it's 255 and I change it to 240 in setup, and after some time user turn on relay2 (there is power down situation) I save Relay2-ON state to eeprom, and when atmega power on void setup is going to change to 240. And all relays are off again.
So this is my real problem.
4  Using Arduino / Programming Questions / eeprom default state on: February 17, 2014, 11:23:56 am
HI to everybody,
Here is my problem, When sketch start I load state of four pin from variable stored in eeprom address 0.
My problem is that default state is 255, meaning in binary code its 11111111.
And because its gsm controled relays, when I upload sketch I get all four relays enabled, and thats not what I want.
I want to be by default 240 or 11110000.
Here is my code:
Code:
#include <EEPROM.h>
#include <GSM.h> // include the GSM library
#define PINNUMBER "" // PIN Number for the SIM
GSM gsmAccess; // initialize the library instances
GSMScanner scannerNetworks;
GSM_SMS sms;
#define gsm 9 // define pin for startup gsm
int addr = 0; // EEPROM address for storing pin state
unsigned char pins;
char remoteNumber[20];
void setup()
{
  // restore the lights
  pins = EEPROM.read (addr);
  for (int i=A0; i<A4; i++) {
    digitalWrite(i, bitRead(pins, i-A0));
  }
  gsmOn(); //power up GSM
  Serial.begin(9600);  // initialize serial communications and wait for port to open:
  //while (!Serial) {
  // ; // wait for serial port to connect. Needed for Leonardo only
  //}
  Serial.println(F("SMS Messages Receiver")); //
  // connection state
  boolean notConnected = true;
  // Start GSM connection
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println(F("Not connected"));
      delay(1000);
    }
  }
  sms.flush();  // delete all messages
  Serial.println(F("GSM initialized")); //
  Serial.print("Signal Strength: "); //
  Serial.print(scannerNetworks.getSignalStrength()); //
  Serial.println(" [0-31]"); //
  Serial.println(F("Waiting for messages")); //
  showFlags(); //
  Serial.println(freeRam());
}
5  Using Arduino / Programming Questions / Re: Help with "dynamic" statement with string and pin state on: February 16, 2014, 01:33:31 pm
Solved.
Code:
else if (txtmsg.compareTo("status") == 0)
  {
    char stg[32];
    if (digitalRead(pin) == HIGH){
      strcpy(stg, "Relej je ukljucen.");
    }
    else {
      strcpy(stg, "Relej je iskljucen.");
    }
    Serial.println(stg);
    sms.remoteNumber(remoteNumber, 10);
    sms.beginSMS(remoteNumber);
    sms.print(stg);
    sms.endSMS();
  }
6  Using Arduino / Programming Questions / Re: Help with "dynamic" statement with string and pin state on: February 16, 2014, 09:33:00 am
Ok. Thanks for the tip. But when I enter the line
Code:
sms.print(stg);
What is going to print?
7  Using Arduino / Programming Questions / [SOLVED] Help with "dynamic" statement with string and pin state on: February 16, 2014, 07:49:13 am
Here is my code:
Code:
else if (txtmsg.compareTo("status") == 0)
  {
     String statustxt = "";
     pinstate = digitalRead(pin);
     if (pinstate == 1){
     sms.remoteNumber(remoteNumber, 10);
     sms.beginSMS(remoteNumber);
     sms.print(statustxt);
     sms.endSMS();
     }
  }
I need to complete the code to do next (my pseudo code)
if txt message is status do next:
if pinstatus == 1
     sting is: relay 'pin' is on
else
string is: relay 'pin' is off
sms.remoteNumber(remoteNumber, 10);
     sms.beginSMS(remoteNumber);
     sms.print(string);
     sms.endSMS();

My brain is stuck, I mean I am stuck at how to create one string with two states.
8  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 10, 2014, 06:19:26 pm
Quote
So, you've connected max232 pin 11 (ttl tx) to (remote) ATMega rx, and max232 pin 12 (ttl rx) to (remote) ATMega tx ?
Yes that is how I connected.
There is no connection (max232 ttl to atmega)on schematic because I dont need it, but I soldered directly on atmega pin 2 and 3.
9  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 10, 2014, 05:43:08 pm
Here are my images
10  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 10, 2014, 05:10:40 pm
I only have one max232.
Yes, max232 inverts ttl signal to serial for pc.
I need this part because on my pcb I only have AVR ISP for programming and I dont know what is goin' on with my code.
So I solder two wires (RX - TX) directly from my serial max232 to ttl converter to atmega. This is some kind of low cost debuging.
This is my first complex project in arduino.
I will draw block schematic and post it what exactly am I doing.
11  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 10, 2014, 04:05:04 pm
Robin2 I am very sorry for my crazy posts, This kind of stupid problem drive me crazy. I am not an expert for electronic but I have a very large will to learn.
Can you please repeat the questions so I can answer you the most exactly.
12  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 10, 2014, 01:38:38 pm
First of all.. I put back atmega on arduino duemilanove board and serial print work on serial monitor.
Next I connect another MAX232N on Pin0 and Pin 1, and again everything work.
But when I put atmega on my pcb I get garbage on serial monitor. Here is picture of my test pcb.
I start to think that there is problem with my pcb.
13  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 09, 2014, 05:28:14 pm
Nothing is missing on schematic. On the right side only is connectors for gsm click 2
14  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 09, 2014, 05:26:35 pm
I dont use normal rx and tx because gsm library use software serial. And in arduino duemilanove ft232 use real atmega hardware serial for upload and monitor serial output
15  Using Arduino / Microcontrollers / Re: Standalone Arduino Serial debug not working on: February 09, 2014, 03:34:34 pm
Entire shematic
Pages: [1] 2 3