Go Down

Topic: Need help to finish the code (Read 5248 times) previous topic - next topic

wvmarle

1, 2, 3 all fixed. That was easy and mostly cosmetic.

4. I have a basic idea on how to fix that. Gotta mess around in the code a bit.

5. If you can give me a series of patterns for this I can easily add it. May think of something myself. Can create 5-10 shorter series and play one of them at the hour, either in order or randomly.

Changed the button code; it now does a very fast check on whether any buttons are pressed, if not returns right away, so playing tunes should not be noticeably affected.

6. I don't have any melodies on hand, I don't even have such a buzzer to try them out.

Dinnertime; continue later.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

wvmarle

4. done, you now have a rate repeat on the minute and hour selections.

5. added a total of 10 patterns, each much shorter than the original one, reused some and added others. Every hour a random special effect will be chosen and played.

6. didn't touch this.

Do give it some thorough testing!
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

4. done, you now have a rate repeat on the minute and hour selections.

5. added a total of 10 patterns, each much shorter than the original one, reused some and added others. Every hour a random special effect will be chosen and played.

6. didn't touch this.

Do give it some thorough testing!

Thanks. Will do a thorough testing when the kids leave. My house is teeming with kids now. All of them are neighbor's kids. If I do anything with the clock right now, they will pull all the cables out and break something. Gotta wait till they leave. :) I shout at them, to make them leave, they cry and leave, but they come again. Can't get rid of them. :)

When they leave, I will do a detailed test. I wish you hadn't fixed the music related bits. because I'm really considering ditching that mario theme alltogether.

So, point 6 is the only outstanding issue, not really an issue, but would be nice to change music as well. and get rid of alarm lighting and buzzing. But I have to find a suitable sketch first.

So now I'm looking for some arduino music sketches online. If I find one that I like, can you implement it? I can turn any desired midi file into an arduino music sketch using an online tool. But the output format is really weird. it puts out code that precisely sings the music but not very user friendly for the programmer. I will try to find a good one to work with. I'm really hoping you will help me with that one also.

Thank you so much.

Cheers.


wvmarle

Fixing the music part (at least I hope it's fixed) was a single line of code, no big deal.

For the other music - I guess it's a matter of plugging it in, but have to see, also how to include the button interruption part in it. That's probably the hardest part.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

Fixing the music part (at least I hope it's fixed) was a single line of code, no big deal.

For the other music - I guess it's a matter of plugging it in, but have to see, also how to include the button interruption part in it. That's probably the hardest part.
Hi. I remember you said alarm was not recording to EEPROM. Have you had a chance to fixe that also?

I'm still looking for a good music sketch. But in case I keep the old one, can you make it so that when the alarm lights follow the music, they flash not all together but row by row? Or would that be too difficult to implement?

wvmarle

Fixed that (I think - didn't really check on it).
Got the address, value order mixed up again in EEPROM.write.

How would the alarm lights have to follow the music exactly?
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

#36
Jan 13, 2018, 07:36 pm Last Edit: Jan 13, 2018, 07:51 pm by arduinoware
Fixed that (I think - didn't really check on it).
Got the address, value order mixed up again in EEPROM.write.

How would the alarm lights have to follow the music exactly?
If you look in void buzz section, I think there is a piece of code that with a tone turns the LEDs on (digitalWrite all LEDs on except speakerPin) and in between the tones turns them all off. But all 13 leds turn on/off together. I wonder if there is a way to make it so that they do that by rows. Like: with a tone 1 row turns on and off. Then with next tone the next row follows. The code is already there. May be it might be possible.

But don't worry if it can't be done. May be I will find a better music. Still looking for it as we speak

arduinoware

#37
Jan 13, 2018, 10:03 pm Last Edit: Jan 13, 2018, 10:30 pm by arduinoware
Fixed that (I think - didn't really check on it).
Got the address, value order mixed up again in EEPROM.write.

How would the alarm lights have to follow the music exactly?
OK, forget the Mario alarm Theme. I want to ditch it together with its buzzing effects for the alarm. I have found a solution for my alarm melody. My neighbor gave me a brilliant idea. He said go simple alarm sound, that way you will never regret or change your mind. I think I like that idea very much. I am going to go simple because simple never gets boring. So, hopefully, it will be simple enough for your to implement and good enough for me to feel good about it :)

So, all I want for the alarm sound is:

 "Beep", "Beeeeeeep" pause "Beep", "Beeeeeeeep", pause "Beep", "Beeeeeeeep" you get the idea. And continue like that. So, a slightly shorter "beep" followed by a longer "beeeeeep". but not "bip" "beeeeeep", rather "beep", "beeeeeeeep" if you know what I mean. Or you can implement a better simple tone combination, if you have one on your mind. Just needs to be simple alarm sounds.

So. simple alarm sounds. And I want these beep durations to be followed with LED lights, turning on for the beeps, and turning off for the pauses. This should be a lot simpler than some of the sh** we are dealing with with Mario theme. Please tell me you can do it. Please. You can perhaps come up with some high pitch sound (the right frequency) which is suitable for the alarm sound.

Actually, it would be a lot better, if you could make only the "time showing LEDs" to flash with alarm beeps, rather than all 13 leds. Do you think you could do that? I realize it is a little over the top. But still.

So, it is going to be like "Beep" small pause "Beeeeeeeeep" main pause; and continue like that. I hope you understand what I mean.

Please implement that and then I will do a full test. I would rather do the test once so that I don't bother you again second time.

Cheers. Thank you very much.

arduinoware

Fixed that (I think - didn't really check on it).
Got the address, value order mixed up again in EEPROM.write.

How would the alarm lights have to follow the music exactly?
You are getting a very special 3rd item from me for doing all this. in addtion to the other 2 which are in transit now. I hope it will make you happy when you get it. Please check the message in the PM :)

Oh, and in addition to my previous message, if you manage to implement the new alarm sound/lights, could you please make sure all the old mario music related bits and buzzing effects are removed from the code. such as the notes declarations, tempo declarations, etc. from the beginning of the code and from other parts of the code. so that in the future it is easy to maintain the code, if I have to. so that, no redundant stuff is left.

Oh and please remember to make it so that alarm lights show, even with general On/Off button in off position, basically the same logic as before but with new alarm lights.

And also the priority thing with hourly specialEffects. if alarm time is reached, alarm lights are priority and hourly special effects are skipped. not just delayed.

And from there on, it will be just a matter of final test.

Thank you very much.


wvmarle

Music stripped. Alarm changed (it's now merged with the special effects function, after all that's what it is).

Supposed working of the alarm (haven't had time to test it at all):
Upon alarm time:
- five half-second beeps (the same 1900 Hz as used for the button bips) with half-second silence. All LEDs ON while beep sounds, normal clock display in between.
- five seconds pause
- this repeats for up to 20 minutes after which it switches off the alarm, unless user presses the alarm button.

Short press: snooze mode.
Clock display remains on (even if the lights switch is set to OFF). You have to wake up so good to see the time.
Then after five minutes the alarm restarts as above.

Long press: alarm off (no more snooze). Display will follow the lights on/off switch again.

Hourly effects are not played if the alarm plays. No delaying of that, the code doesn't even allow for this. Hourly effects are triggered when the second is 0, just like the alarm, but the alarm is checked for first. So unless you manage to switch off the alarm within that first second the hourly effects don't play at all.

As it's set to be special effect, this of course can quite easily be changed.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

#40
Jan 14, 2018, 02:04 pm Last Edit: Jan 14, 2018, 03:42 pm by arduinoware
Music stripped. Alarm changed (it's now merged with the special effects function, after all that's what it is).

Supposed working of the alarm (haven't had time to test it at all):
Upon alarm time:
- five half-second beeps (the same 1900 Hz as used for the button bips) with half-second silence. All LEDs ON while beep sounds, normal clock display in between.
- five seconds pause
- this repeats for up to 20 minutes after which it switches off the alarm, unless user presses the alarm button.

Short press: snooze mode.
Clock display remains on (even if the lights switch is set to OFF). You have to wake up so good to see the time.
Then after five minutes the alarm restarts as above.

Long press: alarm off (no more snooze). Display will follow the lights on/off switch again.

Hourly effects are not played if the alarm plays. No delaying of that, the code doesn't even allow for this. Hourly effects are triggered when the second is 0, just like the alarm, but the alarm is checked for first. So unless you manage to switch off the alarm within that first second the hourly effects don't play at all.

As it's set to be special effect, this of course can quite easily be changed.
Hi. Here is the test results. Unfortunately, there are still some outstanding issues. I hope you can clear them. Please read them carefully. Most of them are minor issues:

1.

There seems to be a major issue with the alarm. I couldn't get it to work under any circumstance. When the alarm time comes, all the LEDs light up and stay that way. And the buzzer tries to make 1 or 2 very bogged down noises or clicks, (barely noticeable) and then there is no sound from the buzzer. Once this happens, all 13 LEDs just stay on and hour/min buttons do nothing. even long presses. The only buttons that work under this condition is longpress buttonAlarm which animates alarm switch on and alarm switch off animations, but then the leds go back on, all 13.

The others are minor, may be, cosmetic issues:

2. Either you misunderstood or I did not explain properly. When you longPress buttonAlarm to switch alarm on, the animation I want is rows filling up, which it does fine, and then only 1 long flash. Please change that to make it happen. currently, it is 1 short, 1 long. I want rows filling up, and then only 1 long flash.

3. The animation for alarm switching off, is also slightly off from what I want. Currently, it is 1 long, 1, short, and rows filling down. I want only 1 short, and then rows filling down.

4. When you are in clock time setting mode, and if you set the time to an even hour and exit to normal display, the specialEffects() plays. Would it be possible to make it so that specialEffects() plays only if even hour is reached naturally?

5. The flashing has been removed for when entering Setting Mode. That is fine. The fast advance of hour/minute buttons works fine, but probably it is because of this that when you long press hour/minute together and first enter setting mode (which is alarm setting first), sometimes alarm minutes advances even though you don't want to change alarm time. Say, you only want to move over to clock setting.

But the long press of hour/minute buttons, affects the alarm value when you first enter alarm setting mode. Initially flashing when entering setting mode did not allow that to happen. so it is gone and the long presses are being registered as attempt to advance minutes on alarm. So, may be introduce a very small delay when you first enter setting mode? to avoid unintentional registering of button press? or would that introduce more issues than it is worth? What is the nicest way to do that without flashes upon enterence to setting mode? I don't want flash there.

6. For alarm sound, you are implementing:

- five half-second beeps (the same 1900 Hz as used for the button bips) with half-second silence. All LEDs ON while beep sounds, normal clock display in between.
- five seconds pause
- this repeats for up to 20 minutes after which it switches off the alarm, unless user presses the alarm button.

But instead of this, can you do:

A shorter beep and a longer beep. So, a short half-second beep, with half-second silence, and a longer, 1-second beep. Then the main pause of whatever feels right.

So, beep, beeeeeeep; pause; beep, Beeeeep; pause; beep,beeeeeep. Something like that . That would be best. I hope it is not too late for this.

Cheers.

arduinoware

Hi.

Did you get a chance to look at the issues?

Please keep me posted. I realize that I've asked a lot. But I really need this thing working.

Thank you so much.

wvmarle

1) have to look into this one. Probably a simple error somewhere. I don't see it right now, this one is for tomorrow.

2, 3) done.

4) fixed: set the seconds to 1 instead of 0 when setting the time, as the alarm only plays when seconds == 0, so you're basically setting the clock past the alarm time. There's no seconds display so that doesn't matter.

5) Added an additional 500 ms delay here. Indeed it will start advancing the minutes right away.

6) So keep that to a 5-second pause? It's easy to change - after all it's implemented as a special effect.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

#43
Jan 14, 2018, 08:24 pm Last Edit: Jan 14, 2018, 08:38 pm by arduinoware
1) have to look into this one. Probably a simple error somewhere. I don't see it right now, this one is for tomorrow.

2, 3) done.

4) fixed: set the seconds to 1 instead of 0 when setting the time, as the alarm only plays when seconds == 0, so you're basically setting the clock past the alarm time. There's no seconds display so that doesn't matter.

5) Added an additional 500 ms delay here. Indeed it will start advancing the minutes right away.

6) So keep that to a 5-second pause? It's easy to change - after all it's implemented as a special effect.
Thanks a lot. OK, one final note on the outstanding issues/changes:

About 1) Yes, please remember to debug that alarm issue.

About 6) If you can do it like I said, which is:

a short half-second beep, then half-second silence, then a long 1 second beep, then 5 second pause is probably too much. I would say, after the long 1 second beep, make the main pause to be only 1 sec. 5 sec is too much.

7)

Additionally, I have found another minor bug. In Time Setting mode (both alarm and clock setting mode), if you have the "hours" selected/flashing, and if you longPress minute button, it advances the "hour" by one, but doesn't continue. if you press and hold minute button, hour will advance only by 1. so, you release the minute button, longPress it again, and it again advances "hour" by one. I believe hour and minute buttons shouldn't be related like this through longPress?? It doesn't happen the other way around. So, if "minutes" are flashing, and if you longpress hour button, it doesn't do that.

8) Lastly, I tried the special effects, and some of them are repetitive. Like some of them are mirrored versions. such as, some of them are set up so that if the previous effects start from left side and end on right side, the next one is the opposite. I would like to suggest a few more special effects. But I don't want to have more than 10. So, can you please remove the boring ones or repetitive ones and implement the following 4 effects:

I tried to show with 0s and 1s but when I submitted the post, 0s and 1s were all over the place.

Effect 1)

So, I will try to explain with words. it is like a worm entering from top left and going right. then entering from second row right, going left, and so on, all the way to the bottom. like zig zag motion, left, right, left, right. from top to bottom. I hope you understand.

Effect 2) The same as above, but going vertical. up and down. from one side to the other side.

Effect 3) Alternating lights:

  1  1     0  0    1   1     0  0     1   1     0  0    1   1    0  0
  010    101     010     101     010     101     010     101
0101  1010   0101   1010    0101   1010   0101    1010
1010  0101   1010   0101    1010   0101   1010    0101

Effect 4)

Rows fill one by one from top to bottom, but windows by window, not row by row. Please make the 1st row fill from left to right, the 2nd row fill from right to left. etc. like zig zag, and rows empty in the same fashion. once they are filled.


So, that is everything.

thank you :)

arduinoware

Like I promised, item posted by mail.

But please check my final notes in my previous PM or the latest forum post.

About your solution when setting time, to set seconds to 1 instead of 0, to set time past the alarm time (in order to skip special effects when setting time manually), I don't feel good about it. I am a little obsessed which is not your fault :) But still, can you please find another solution for this? I really want to be setting seconds to 0 when setting time.

Thank you.

Go Up