Show Posts
Pages: 1 ... 6 7 [8] 9 10 ... 147
106  Using Arduino / Displays / Re: Sending text from the Serial Monitor to an LCD dispalyer on: July 11, 2014, 08:11:05 am
t you need to tell me how to wire the LCD and Arduino

Check the Hello World example in the IDE
107  Using Arduino / Networking, Protocols, and Devices / Re: Programming Tx and Rx pins on HC06 on: July 11, 2014, 02:54:38 am
Actually, I don't think you can do this with an HC-06 because of the restricted number of AT commands available to it, but I believe you can with an HC-05, and the command is on the data sheet.
108  Using Arduino / Displays / Re: How do I display serial data to nokia 5110 lcd? on: July 10, 2014, 06:39:07 pm
This is an old thread, there is nothing worth sharing, nothing to learn, and just about every line in the code is utter junk, so no wheel either.

I'm not sure what you expected to learn. If it is about thermistors, I don't use them but there is plenty of better information to be had around here. If it is about using the 5110, this is a good place to start.

https://code.google.com/p/pcd8544/

I have not used it myself but I suspect that Henning Karlsen is an even better source.

The 5110 is a great little display, probably the best value around!


109  Topics / Home Automation and Networked Objects / Re: DS18B20 on: July 10, 2014, 05:34:08 pm
I don't think there is an error in my code. It compiles properly and it is working right now before my eyes.

I don't know what your problem is, but there are two things you need to do.

The first is to learn how to post code. A picture is not really going to help much. Use the hash icon and insert it between the pair. "Please Read..." instructions  abound at the top of every forum section.

The second is that you have not inserted the addresses of your sensors into the code. I don't think that is the cause of your problem but it will certainly stop you getting a result when you fix it.

I now think it is likely that your problem has occurred because you have not properly installed theDallasTemperature library. "Properly installing"  includes restarting the IDE after installation, even if you have put it in the right place.  In short, you may find you get a result now by the simple expedient of restarting the IDE, i.e. the code is 110% kosher, but the IDE didn't know what the hell you are talking about.

You will notice that the IDE takes for ever to start. I believe this is because it does a great swag of chores first, including a browse through the libraries.
110  Using Arduino / Project Guidance / Re: aquarium project on: July 10, 2014, 09:43:58 am
First up, the ino is for a 320x240 display. I would have thought a 7" screen would have higher resolution than that, therefore I believe you are using the wrong example.

Secondly, I recall some note about 7" displays on the Henning Karlsen website. You might have a look there.
111  Using Arduino / Displays / Re: Sending text from the Serial Monitor to an LCD dispalyer on: July 10, 2014, 08:40:36 am
I assume you really want to send the temperature from the sensor to the LCD.
I don't know why you would call a float for tempC. Probably a mistake.

Code:
float tempC;
int tempPin=0;
#include <LiquidCrystal.h>
// initialize the library with the numbers of YOUR interface pins
LiquidCrystal lcd(8,9,4,5,6,7);

void setup()
{
  Serial.begin(9600);
  lcd.begin(16, 2);
}

void loop()
{
  tempC=analogRead(tempPin);
  tempC=(5.0*tempC*100.0)/1024.0;
  Serial.println(tempC);
  lcd.setCursor(0, 1);
  lcd.print(tempC);
  delay(3000);
}
112  Using Arduino / Project Guidance / Re: Arduino Uno with Android on: July 09, 2014, 09:52:16 pm

Nick - I'll get back to you to find out the cause of the super quick lighting. I suspect right now that they made it that quick because the high speed camera could take pictures at that rate so they wanted to make it as quick as possible so they can image as many samples as possible.

OK, on the strength of that and, as I warned, it could be that the "they" are either stupid, or they think you are. You can test this and/or get your own back by blinding them with science. Just ask whether by "high speed" they mean exposure, frame rate, or both and just what the numbers are.  If they can't answer, they are stupid. If they can, they will know you are just as smart as they are, which is a good way to get some better and more forthcoming dialogue.

I have no idea how you control the exposure on an Android camera to take photos. I thought you just pointed it and pushed the button. However, the Android is capable of taking movies. I have no idea what the frame rate is, but somebody surely does.. Furthermore, you might find the frame rate is adjustable under certain circumstances. I doubt this can be set by the user but it may be controllable if the user can set the circumstances. You will be amazed how slow the exposure can sometimes be, but a movie camera is a high speed still camera, and electronic ones can easily deliver 60 frames a second. The slow frame exposure may be immaterial anyway.

You may find that all you need do is synchronise the Arduino with Android's movie. It is likely to be all you can do, but don't ask me how.  

It occurred to my while riding over the Narrabeen bridge this afternoon that the synchronising might be quite easy if live adjustment is done with Android controlling Arduino as you should be able to see what's going on on the screen - visual feedback.

113  Topics / Science and Measurement / Re: Two channel interrupt driven datalogger - Need to reduce code size on: July 09, 2014, 09:11:26 pm
OK, in that event you might find that, since most of the size of a Mega is taken up by pins and tracks that are of no interest, building up a custom Mega equivalent from scratch might fix the problem, and you develop the job on  a plain-vanilla Mega.

I note you have two time-related libraries. That is not necessarily a problem in itself but I can't see why you are doing that. I'm not familiar with the DS3232 but I understand all the DSxxxx clocks are coded the same way. I have found that the most code-efficient way to get the time is here

http://bildr.org/2011/03/ds1307-arduino/

This approach uses no libraries and no strings either

I use libraries for stuff like datestamping the SD, but am still in front by using the above to get the time. I found this while vainly struggling to use the Uno as a datalogger. No promises of salvation, but it might help. 

IF the real job of your display is this:

Code:
    TFTscreen.text("Time:", 0, 0); // write the text to the top left corner
    TFTscreen.text("Date:", 0, 20);
    TFTscreen.text("Temp:", 0, 40);
    TFTscreen.text("Humid:", 0, 60);
    TFTscreen.text("Count1:", 0, 80);
    TFTscreen.text("Count2:", 0, 100);

I submit the LCD you are using is a bad choice. It is grossly underutilised, a waste of money, and probably a waste of space as well. If you want the fancy stuff, you pay a high price for it in memory, and speed as well for that matter.  If you can do without it, a Nokia 5110 will deliver the above data with about 90% less code, and cost you $5.

The pictures below show a 5110 and a TFT. They are interchangeable, and the fundamental information they display is the same but don't even think about putting a UNO under the TFT, even if it did fit physically.   

I have already commented on that string stuff. In short, any code with the letters str in it should be deemed unwarranted, and the kiss of death. There is also a lot of stuff involving const ints, unsigned longs, bytes, and god only knows what all else that suggests that your code  is either very efficient or verbose junk, but it will take a better man than me to check. It needs checking nonetheless.

This code is just a simple clock with Nokia 5110. It shows the efficiency of both.

Code:
#include <PCD8544.h>
#include "Wire.h"
#define DS1307_ADDRESS 0x68
static PCD8544 lcd;

void setup(){
  Wire.begin();
  Serial.begin(9600);
  lcd.begin(84, 48);
 
  // Print a message to the LCD.
    lcd.setCursor(0,0);
  lcd.print("Today it is");
}

void loop(){
  printDate();
  delay(1000);

}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

void printDate(){

  // Reset the register pointer
  Wire.beginTransmission(DS1307_ADDRESS);

  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 7);

  int second = bcdToDec(Wire.read());
  int minute = bcdToDec(Wire.read());
  int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
  int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(Wire.read());
  int month = bcdToDec(Wire.read());
  int year = bcdToDec(Wire.read());


  lcd.setCursor(21,1);
    switch (weekDay)               // Friendly printout the weekday
  {
    case 1:
      lcd.print("MONDAY  ");
      Serial.print("MON  ");
      break;
    case 2:
      lcd.print("TUESDAY  ");
      Serial.print("TUE  ");
      break;
    case 3:
      lcd.print("WEDNESDAY  ");
      Serial.print("WED  ");
      break;
    case 4:
      lcd.print("THURSDAY  ");
      Serial.print("THU  ");
      break;
    case 5:
      lcd.print("FRIDAY  ");
      Serial.print("FRI  ");
      break;
    case 6:
      lcd.print("SATURDAY  ");
      Serial.print("SAT  ");
      break;
    case 7:
      lcd.print("SUNDAY  ");
       Serial.print("SUN  ");
      break;
  }

  Serial.print(monthDay);
  Serial.print("/");
  Serial.print(month);
  Serial.print("/");
  Serial.print(year);
  Serial.print(" ");
  Serial.print(hour);
  Serial.print(":");
  Serial.print(minute);
  Serial.print(":");
  Serial.println(second);
 
   lcd.setCursor(0,4);
  lcd.print(monthDay);
  lcd.print("/");
  lcd.print(month);
  lcd.print("/");
  lcd.print(year);
 
  lcd.setCursor(0,5);
 
   if( second==0)
  {
   lcd.print("         ");
   lcd.setCursor(0,5);
   }
 
  lcd.print(hour);
  lcd.print(":");
  lcd.print(minute);
  lcd.print(":");
  lcd.print(second); 
}





114  Using Arduino / Displays / Re: How do you properly convert values into String so as to display on the TFT LCD? on: July 09, 2014, 09:15:56 am
And, further to that, state the objective, post the code, and describe the LCD.
I don't think you should have to suffer from anything to do with strings of any sort and, if you insist on doing so, you deserve all the grief you get. You should be able to print in the simple manner I described above. The only time I have ever had to use  the dtostrf() function is when I was feeding data to alien software on  an alien device.
I don't think it's likely, but if your LCD library really demands that you take this route, looking for an alternative library written by somebody more competent  would be a good idea.
115  Using Arduino / Networking, Protocols, and Devices / Re: Programming Tx and Rx pins on HC06 on: July 09, 2014, 03:30:43 am
I want to connect a LED between the Tx pin of HC06 and a gnd and turn it On/Off from my laptop via bluetooth (without an Arduino).

I believe it is possible to do essentially what you want but you connect the LED to one of the other contacts on the HC-06.
116  Using Arduino / Networking, Protocols, and Devices / Re: Problems with AT commands to Bluetooth HC-06 on: July 09, 2014, 03:26:07 am
I want to connect a LED to the Tx pin of HC06 and turn it On/Off from my laptop via bluetooth (without an Arduino).

I believe it is possible to do essentially what you want but you connect the LED to one of the other contacts on the HC-06.
117  Topics / Science and Measurement / Re: Two channel interrupt driven datalogger - Need to reduce code size on: July 09, 2014, 03:20:09 am
OK, here is the bottom line first.  Disconnect the Nano from various sensors, put in in the bottom drawer, and get a Mega.

Just counting the number of #includes is enough to reveal the problem, without worrying about the rest of the code. And the problem is that your project is too big for a Nano. What's more, the problem is likely to get worse and, if it wasn't too big right now, it probably will be next week. 

Further, while 31946 might be "just over" to load into Nano, trimming it down a few bytes here and there to "just under" isn't necessarily going to save you. Managing to load a programme is not a guarantee that it will run, and the time to get confident is when it is below about 30k. Now you have gotten this far, you will be amazed how difficult it is do that.

None of the following is a solution to your problem but:-
Maybe my paranoia is showing, but I would be vary wary of that datastring stuff. It is probably unwarranted, and something you may well later regret later. Further, I have never seen SoftI2C before and wonder why you would use it when nobody else does.

No need to apologise for the code style. It is pretty well presented, and I imagine it is pretty kosher. There is just too much of it,.
118  Using Arduino / Project Guidance / Re: Serial comm to iphone not working on: July 08, 2014, 08:20:43 pm
The problem might be just mechanical. I won't ask how you make the actual connection to the phone but, whatever it is,working on a D9 must be easier, and there is a cable available for iPhone<>RS232.
119  Using Arduino / Displays / Re: How do you properly convert values into String so as to display on the TFT LCD? on: July 08, 2014, 07:55:07 pm
The program works properly on the serial monitor but my goal is to display them on the TFT LCD instead.

 I believe I am doing it wrongly


You are probably right

You should be able to print on LCD everything you can print on the serial monitor, and in more or less the same way. The only difference is in the placement. There should be no need to convert values to strings.

Something like
Quote
float data
data = 12.34

Serial,print("data=    ");
Serial.println(data):
TFTscreen.txt("data=  ",0,0);
TFTscreen.txt(data,0,10);

I'm not familiar with this LCD but there should be something to this effect included in the library it uses. The TFT code I use has a command printNum i.e. it distiguishes between text and numeric data. Yours may be similar.
120  Using Arduino / Displays / Re: LCD newbie HELP! on: July 08, 2014, 09:36:02 am
The 16 pins refers to the row of connectors on the LCD. The displays themselvces could be identaL, just one is already on a shield and the other isn't. There is no problem connecting the first to an Arduino, you could even mount it on a shield. The second is more convenient. I assume the second is more expensive but the extra $4 is well worth it, even if, like me, you never use the buttons.

Note that the bare display is the "standard" method and I believe it is implemented painlessly with the standard example given. The shield design of the second varies between manufacturers and there can be problems getting the connections right in the code. This is a problem that only happens once and should not be enough to deter you from getting it. It is just a matter of being forewarned and forearmed and you might ask the supplier about this.

 
Pages: 1 ... 6 7 [8] 9 10 ... 147