Notifications
Clear all

ask for help  

Page 1 / 2
  RSS

gekopmac
(@gekopmac)
New Member
Joined: 8 months ago
Posts: 2
2020-05-06 7:58 pm  

Hello all,
I am arguing with MAX7219 LED Microcontroller 4 In 1 Display With 5 Pin Line.

The text is not good or is upside down. I am a beginner and am looking for a sketch which module can test for module which one is wrong, have read somewhere that sometimes it is possible that a module is mounted incorrectly.

for example:
matrix 1 led 1 to 64, matrix 2 1-64 etc to 4.

tried all the different sketches but I can't figure out which one is wrong or upside down.

Best regards
Henk de Sain


Quote
Topic Tags
gekopmac
(@gekopmac)
New Member
Joined: 8 months ago
Posts: 2
2020-05-09 9:39 pm  

<SOLVED>

you have to change the scetch and not the library.

all ok.

 

rgd

 


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 8 months ago
Posts: 15
2020-05-15 12:38 pm  

I am trying to use part of controlling  dc motors with L298N and arduino for my switching locomotive

To increase speed I use the for (i=0;i<256;i++) and analogWrite (PWM,i) and a delay(20)

to increase the speed from zero to a certain speed. However, the delay(20) is necessary to get a slow increasing speed, and works ok. Now I want the speed stay at that speed until I find a stop signal ( reed relay and magnet, and than decrease speed to zero. However due to the delay(20) the increased speed stops after a few seconds and than start all over again. How can I get the increase of the speed and than stay at that speed indefinitely until new command is given.


ReplyQuote
triform
(@triform)
Reputable Member
Joined: 1 year ago
Posts: 331
2020-05-15 3:45 pm  

@runutral

Once you get to the speed you want, drop out of the loop or end it.  The last analogWrite value you write will be used.


ReplyQuote
starnovice
(@starnovice)
Estimable Member
Joined: 1 year ago
Posts: 169
2020-05-15 4:47 pm  

@runutral Put the delay before the analogWrite

Pat Wicker (Portland, OR, USA)


ReplyQuote
byron
(@byron)
Reputable Member
Joined: 1 year ago
Posts: 354
2020-05-15 4:54 pm  

@runutral

I've recently been dabbling in a small 'run a motor' program and as triform indicates the speed up the motor bit is usually over and done with once the motor is running at the desired speed and your program should be ready for some other command.  

In my program I have a function where I pass the desired speed in as a function parameter. (e.g. void go(int ChgSpeed) {....} ). In your case, in your function, you could replace your 256 number in your for loop with a variable.  (for (i=0;i<ChgSpeed;i++) Outside of the function the variable would be assigned a number, e.g. 256 and this is passed to the function.   The function then ramps up your motor and when done will return control the main program ready for the next command.  The next command could be to stop the motor so the value of 0 is assigned to the variable and the function is called again.   Note that in the function one simple for loop will not cater for both ramping up a ramping down the motor, but throw in a few if statements or whatever (lots of ways to code this) and it should work a treat.   

A final though for you is what happens if a stop is required when your function is ramping up to speed. If this is a possibility then you will need to check for something (a global variable setting perhaps) at each point in your loop.  In your example this would be after each iteration of your for loop.  The minimum time your loop could check this is after every delay(20) and if that too long a time and you want an immediate stop there are other ways to signal an immediate stop if this is necessary.

I hope this has given you some food for thought 😀 

This post was modified 6 months ago by byron

ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 8 months ago
Posts: 15
2020-05-15 7:22 pm  

@byron

Thanks for your answer. The stop will not be called before the motor is up to speed. The speed will be set to a low value. Switching loco do not move fast for real. I am going to try a function as you suggested.

I am looking for the possibility to just run the loop for just one cycle, and have the motor stay on that set speed for starters. The stop will be the next fase. After that is the inclusion of an remote control. An other arduino will have the real program that gives the start of the loco, the loco stops when finding a magnet with reed relay. The program tells where the loco goes and set switchces, as well as uncouplers, The program will direct the loco to pick up and deliver cars.


ReplyQuote
byron
(@byron)
Reputable Member
Joined: 1 year ago
Posts: 354
2020-05-15 8:15 pm  

@runutral

Be sure to run the function outside of the void loop() {} or it will continuously cycle your code.  Run it from setup() or even maybe just put your code in setup.  And note what @starnovice said above, you dont want a final delay after you've reached top speed, so put the delay first.


ReplyQuote
Chukwunachi Ebube
(@ebube)
New Member
Joined: 6 months ago
Posts: 4
2020-05-31 6:54 pm  

Please I actually need a help of how to boot load ATmega328p I.C

I will be glad if anyone can help me out

This post was modified 5 months ago by Chukwunachi Ebube

ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 1 year ago
Posts: 747
2020-05-31 7:16 pm  

@ebube

What are you having trouble doing?  Bill did a pretty good video on doing this exact thing,  You do need to be sure that the model of the ATMega328 chip has the "P" after the number 328.  And also, depending on where you purchased your chip, or chips, they may or may not actually have the boot-loader already on the chip.  Did you source say it already had the boot-loader on the chip?  If it didn't, then odds are that it will need the boot-loader programmed on chip before you can load your program.

Here is a link to that video: Bill's Video on using the ATMega328P chip

SteveG


ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 1 year ago
Posts: 747
2020-05-31 7:18 pm  

@ebube

And now that I re-read your post I think I have answered my own question and it does look like you need help putting the boot-loader on the chip.  I have done some work along those lines but don't have my notes handy.

SteveG


ReplyQuote
Chukwunachi Ebube
(@ebube)
New Member
Joined: 6 months ago
Posts: 4
2020-06-01 11:42 am  
9F308498 726C 4C03 9090 C3BD836632C4

Actually this is the error massage am getting while boot loading the Atmega328p IC 

PLS CAN ANY ONE HELP ME OUT PLEASE 


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 8 months ago
Posts: 15
2020-06-11 12:53 am  

@byron

 

I had my switching program almost working using the remote control using nrf24. Suddenly, my arduino ide did not work any more. When I start the program it comes up with "initializing packages" and than it disappears, program does not start up. I deleted the program and installed the IDE again. However I have the same problem. Any suggestions how to fix this. Have no clue why the program stopped working in the first place, used it a couple of hours before with no problems.


ReplyQuote
byron
(@byron)
Reputable Member
Joined: 1 year ago
Posts: 354
2020-06-11 1:21 am  

@runutral

I dont have a clue I'm sad to say.  I use the arduino IDE on my mac and Ive not had any problems over the years with whatever the latest version is/was. (mine is 1.8.12)   My only suggestion is to make sure you remove all of the arduino programs and folders on your computer, BUT AFTER you have copied your *.ino programs somewhere safe.  Then download a fresh copy of the latest IDE that is relevant to your computer (make sure you go for the stable version, not the hourly releases or beta versions) and re-install it all. You will have to reinstall all the extra libraries you may have installed.  However, before launching into my drastic remedy I suggest you may well get some much better feedback if you post your woes on the Arduino forum.  Be sure to include all the relevant information such as your computer, operating system version, arduino version and all that vital info.   Good luck.


ReplyQuote
Macoofer
(@macoofer)
Eminent Member
Joined: 6 months ago
Posts: 28
2020-06-11 10:21 am  

@ebube

 

I've noticed that this often happens when external communication devices are hooked onto the Arduino, messing up the serial exchange with your PC.

I had it happen a couple of times when I was experimenting with an IR receiver module:

If you have any modules connected, disconnecting the module during the upload or shortly removing power from your project during upload might solve this problem.


ReplyQuote
Page 1 / 2