Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Installation & Troubleshooting / Re: OLD STORY: avrdude: stk500_getsync(): not in sync: resp=0x00 on: January 21, 2014, 05:09:41 am
I had this problem today. I just let Win7 automatically troubleshoot the problem at Control Panel -> Devices and Printers, and that solved it for me.
2  Using Arduino / Sensors / Re: IR - recieve(d) code(s) - howto use ??? on: December 28, 2013, 12:20:59 pm
An extremely cool project would be to make a translator for IR remotes. Use your old favorite remote from an outdated or defective set, let the Arduino read the signals from it, and transmit the codes that your new set uses from that new, frustratingly user hostile remote. I'm sure someone must have tried that(?)
3  Using Arduino / Sensors / Re: DS1302 Time set on: December 24, 2013, 04:07:44 pm

These comments I don't understand:

// Enable Register
#define DS1302_WP DS1302_D7   // 1 = Write Protect, 0 = enabled

// Start by clearing the Write Protect bit
// Otherwise the clock data cannot be written
// The whole register is written,
// but the WP-bit is the only bit in that register.
DS1302_write (DS1302_ENABLE, 0);


Neither do I, but hopefully I don't have to to use the code.

I would like to lift the "SET_DATE_TIME_JUST_ONCE" out from the setup and in to a separate function, so what remains of it in setup is just:
Code:
#ifdef SET_DATE_TIME_JUST_ONCE 
  // Fill these variables with the date and time.
  // int seconds, minutes, hours, dayofweek, dayofmonth, month, year;
  setTime(0, 14, 1, 4, 9, 5, 2013);
#endif

Then the new function would look something like this:
Code:
setTime(int seconds, int minutes, int hours, int dayofweek, int dayofmonth, int month, int year)
{
  // Set a time and date
  // This also clears the CH (Clock Halt) bit,
  // to start the clock.

  // Fill the structure with zeros to make
  // any unused bits zero
  memset ((char *) &rtc, 0, sizeof(rtc));

  rtc.Seconds    = bin2bcd_l( seconds);
  rtc.Seconds10  = bin2bcd_h( seconds);
  rtc.CH         = 0;      // 1 for Clock Halt, 0 to run;
  rtc.Minutes    = bin2bcd_l( minutes);
  rtc.Minutes10  = bin2bcd_h( minutes);
  // To use the 12 hour format,
  // use it like these four lines:
  //    rtc.h12.Hour   = bin2bcd_l( hours);
  //    rtc.h12.Hour10 = bin2bcd_h( hours);
  //    rtc.h12.AM_PM  = 0;     // AM = 0
  //    rtc.h12.hour_12_24 = 1; // 1 for 24 hour format
  rtc.h24.Hour   = bin2bcd_l( hours);
  rtc.h24.Hour10 = bin2bcd_h( hours);
  rtc.h24.hour_12_24 = 0; // 0 for 24 hour format
  rtc.Date       = bin2bcd_l( dayofmonth);
  rtc.Date10     = bin2bcd_h( dayofmonth);
  rtc.Month      = bin2bcd_l( month);
  rtc.Month10    = bin2bcd_h( month);
  rtc.Day        = dayofweek;
  rtc.Year       = bin2bcd_l( year - 2000);
  rtc.Year10     = bin2bcd_h( year - 2000);
  rtc.WP = 0; 

  // Write all clock data at once (burst mode).
  DS1302_clock_burst_write( (uint8_t *) &rtc);
#endif
}

The reason I want to lift it out is to reuse the function in order to be able to adjust the time, not by reprogramming the sketch but by user input.

My questions are:
1. Will this function work? (Do I dare to make this change?)
2. Do I need something more to call it from other places of the sketch, i e loop()? Or do I need some more code before or after the function call, like the "DS1302_write (DS1302_ENABLE, 0);" that I do not quite understand the meaning of?
4  Using Arduino / Audio / Re: WT5001M02-28P another mp3/wav cheap sound module on: June 17, 2013, 09:29:31 pm
I'm probably very spoiled, but I don't find that module very cheap.

I can buy a car mp3 player/transmitter with USB connector, SD card reader, remote control and decent sound quality for maybe $4.00. But just an mp3 player without FM transmitter, without remote, without USB but with Arduino compatible input pins instead of buttons is $19.99. Why? I guess part of the explanation is the fact that they don't make this in the same quantities. But yet, $20?
5  Using Arduino / Displays / Re: [SOLVED] LiquidCrystal.h and 8-bits Mode on: May 11, 2013, 06:08:51 pm
Quote
I think you are misunderstanding how sprintf() works.
 8< - - -
0 will work just fine.

Really? I thought all functions in the printf family use \0 as the string termination character.

If I ever need all 8 custom chars, I will have a look at using the 0 position, too. Either by trying to call it as 0 or as 8.

It's funny, I've used printf(), sprintf(), and sprintf() since 1996 or so, without understanding how it works, but yet the part of it I do understand works just as I expect it to. smiley I'm old and slow on learning new stuff. I like using the printf syntax, since it is in line with my way of thinking. And best of all, I can write the whole line in one statement. It gives me the feeling I'm in complete control of the output format. smiley

6  Using Arduino / Displays / Re: [SOLVED] LiquidCrystal.h and 8-bits Mode on: May 10, 2013, 12:44:56 pm
Quote
You can access position 0 by using address 8.
That's wierd, but good to know. Thanks!

Quote
I want to make sure that you have figured out that using the 8-bit interface does not provide access to any more (or any fewer) features than does the 4-bit interface.
Yes, I'll go for 4-bits. I incorrectly assumed that accessing the upper half of the character table required 8-bit. Didn't think it through very much; confusing some old synthesizer MIDI sounds and IBM ProPrinter common character table stored in 7-bits format, and not four but yet only half as many possible values as 8-bit.Totally mixed it up in other words.

/SimLego
7  Using Arduino / Displays / [SOLVED] LiquidCrystal.h and 8-bits Mode on: May 09, 2013, 08:46:34 pm
Yes, it works! Thank you very much!

Code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 6, 5, 4, 3);

byte customCharAA[8] = {
0b00100,
0b00000,
0b01110,
0b10001,
0b11111,
0b10001,
0b10001,
0b00000
};
byte customCharAE[8] = {
0b01010,
0b00000,
0b01110,
0b10001,
0b11111,
0b10001,
0b10001,
0b00000
};
byte customCharaa[8] = {
0b00100,
0b00000,
0b01110,
0b00001,
0b01111,
0b10001,
0b01111,
0b00000
};
byte customCharOE[8] = {
0b01010,
0b01110,
0b10001,
0b10001,
0b10001,
0b10001,
0b01110,
0b00000
};
void setup()
{
  char s[17];

  lcd.createChar(1, customCharAA);
  lcd.createChar(2, customCharAE);
  lcd.createChar(3, customCharOE);
  lcd.createChar(4, customCharaa);

  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.print("Hello, world!");

  lcd.setCursor(0,1);
  sprintf(s,"ABC%c%c%c,abc%c%c%c.", 1, 2, 3, 4, 225, 239); // "ABCÅÄÖ,abcåäö"
  lcd.print(s);
}

void loop() {}
(I skipped position 0 in order to be able to use sprintf() without null-terminating the string.)

Back to main project.
8  Using Arduino / Displays / Re: LiquidCrystal.h and 8-bits Mode on: May 09, 2013, 07:49:01 pm
Oh, I found a "font table", and to my great disappointment, only two of the six Swedish letters were represented, 'ä' and 'ö'.

With this workaround,
Code:
void setup()
{
  char s[17];
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.print("Hello, world!");
  lcd.setCursor(0,1);
  sprintf(s,"ABC%c%c.",225, 239);
  lcd.print(s);
}
at least I am able to display those two characters. I guess the compiler doesn't recognize them from the keyboard entry. It also works in 4-bits mode, so hooking up four more cables was in vain.

Now, didn't I stumble on a page that explained how to enter custom characters somewhere...?
9  Using Arduino / Displays / [SOLVED] LiquidCrystal.h and 8-bits Mode on: May 09, 2013, 07:03:46 pm
I have tried to modify the example code from http://arduino.cc/en/Reference/LiquidCrystalConstructor to make my 16x2 LCD display work with 8-bits characters in order to display the whole Swedish alphabet.
Code:
#include <LiquidCrystal.h>

//LiquidCrystal lcd(12, 11, 6, 5, 4, 3);
LiquidCrystal lcd(12, 11, 10, 9, 8, 7, 6, 5, 4, 3);

void setup()
{
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.print("Hello, world!");
  lcd.setCursor(0,1);
  lcd.print("ABCÅÄÖ,abcåäö.");
}

void loop() {}

I added the four extra wires required for 8-bits mode:

Please ignore the temperature sensor for now.

But the output is exactly the same as if I had hooked it up for 4-bits mode.

What am I missing?
10  Using Arduino / Project Guidance / Re: Pinball Project on: May 06, 2013, 07:21:23 pm
Cool, chris91!

I assume you are talking about Gottlieb's System 1, since I believe Recel went straight to "System 3" for unknown reasons. It would be interesting to know the name of the game you are reviving.

For most functions, I found it much easier to repair (where needed) the existing boards, rather than making new. However, some areas of the Driver/Multiplexer Board of my Crazy Race machine was so burnt that I let Arduino handle the multiplexing and made a new Lamp Driver "Add-On" Board for the bonus lamps.

But I repaired the control board for the 7 segment displays by replacing 2 fried 7475's and then I imitated the signals from the totally destroyed CPU Board, step by step just like you. To generate a refresh frequency matching my machine, I inserted a 150 microseconds delay before each strobe (two digits displayed at each strobe) and then activated for 700 microseconds:

Code:
    delayMicroseconds(150);
    digitalWrite(X[i_strobe], HIGH);
    delayMicroseconds(700);
    digitalWrite(X[i_strobe], LOW);

Please note that if you have another system, you probably will have to use different delays. Also note that my approach requires two Arduinos; one for the playfield and one dedicated to control the top box.

I put 1N4148 diodes between the Arduino and solenoid drivers, just in case one of the driver transistors would break down and short, and send 40 volts back to the output pins of the Arduino. I don't know if this will help, but at least it makes me feel a bit better. smiley

Good luck with your project, chris91! Please let me know of its progress.
11  Community / Exhibition / Gallery / Arduino brings new life into dead pinball machine on: April 20, 2013, 09:29:03 am
Two Arduino units bring back life to a dead pinball machine.

(Don't turn up the sound; the four photos and first clip are silent, but the rest of the clips are loud).

Huge thanks to all Arduino forum members who have patiently helped me!

/SimLego
12  Using Arduino / Programming Questions / SOLVED - EEPROM read and write on: April 15, 2013, 09:03:35 pm
I got it working now. Thanks again!
13  Using Arduino / Programming Questions / Re: EEPROM read and write on: April 15, 2013, 11:14:10 am
Oh, sorry. Now I understand. If you enter the third place on the list, there is no point in overwriting the first two entries.

Pardon me.
14  Using Arduino / Programming Questions / Re: EEPROM read and write on: April 15, 2013, 11:03:51 am
Thank you, both of you!

Quote
you could extend the life of your eeprom when writing by using the method below:

Quote
And when the highscore table changes, a function named "void updatehighscores()" is called to write the new table into the EEPROM.

It won't overwrite the list with an identical one at every Game Over. smiley
15  Using Arduino / Programming Questions / EEPROM read and write on: April 15, 2013, 10:29:04 am
My pinball project is almost completed now. At least when it comes to wiring and setting up all the hardware. One of the things that remain is programming the code for the Highscore tables.

The 8 highscores will be stored here:

Code:
unsigned long int hiscore[8];

On startup, I want load the highscores from the EEPROM area into the hiscore RAM array with a function named "void loadhiscores()".
And when the highscore table changes, a function named "void updatehighscores()" is called to write the new table into the EEPROM.

But EEPROM.read and EEPROM.write only handles single bytes and not long int's, and the information on http://playground.arduino.cc/Code/EEPROMWriteAnything is way too advanced for me to understand and apply on my problem. Would anybody like to help me write the code to these two small functions? I would be very thankful, and of course give proper credits when I present my Pinball Project. (I know people are asked to attach the whole sketch and not just a snippet, but so far I have not written any high score related code and I believe I supplied enough information. Btw, the sketch for the Playfield Unit is already 17kb, and of no help for this question).

TIA,
SimLego
Pages: [1] 2 3 ... 5