Arduino, and everything connected with it | [robots]



Rep: (341)
ODROID-N1 | ODROID-C2 | ODROID-C1 / C1 + / C0 | Orange pi | Banana pi | Raspberry pi


Arduino, and everything connected with it


Attached Image



Photo
Attached ImageAttached Image
Attached Image
Description
Arduino is a family of devices for building simple automation systems and robotics, aimed at non-professional users.
Projects of members of the forum



Post has been editedyahcka - 25.04.18, 22:12
Reason for editing: Removed space



Rep: (1090)
in si for stm32 using a simple editor and gcc

with a study of HAL and CPU memory architecture. There is such an interesting thing as ld scripts.
So, for different variants of STM32 they are different. And you often have to compose them yourself.



Rep: (58)
* Azathtot , in one article I found an ld script for my version of stm, and bootstrap.s was also attached to it, where, as the author writes, assembler is used, and it just runs an infinite loop



Rep: (1090)
* parshukofff
Well, you will have to indicate memory with an ld script.
Well, an infinite loop is also not a bad example :) It is not necessary to write it in assembler, you can also use C
But it’s better to look at examples, for examplehere(F103 processor)

Post has been editedAzathtot - 07.03.19, 14:38



Rep: (58)
* Azathtot , you can tell some article where the basics would explain how to work with mk (I mainly worked only with lua and javascript)



Rep: (1090)
* parshukofff
You will not believe! Website STM Electronic!tyk
hereherehow to configure and use gcc
Well, in general, you need to start with the hardware, on the STM site a lot of documentation
Unfortunately, without an idea of ​​“how it works,” you won’t write much about MK.

Post has been editedAzathtot - 07.03.19, 15:17



Rep: (0)
Dear forum users, can anyone help?
In general, there is a sketch, but it knocks out an error. Can anyone tell me how to fix it?
int senseLimit = 1023;
int probePin = 5;
int val = 0;

int LEDl = 11;
int LED2 = 10;
int LED3 = 9;
int LED4 = 8;
int LED5 = 7;
int LED6 = 6;
int LED7 = 5;
int LED8 = 4;
int LED9 = 3;
int LED10 = 2;
int readings [NUMREADINGS];
int index = 0;
int total = 0;
int average = 0;

void setup () {
pinMode (2, OUTPUT)
pinMode (3, OUTPUT)
pinMode (4, OUTPUT)
pinMode (5, OUTPUT)
pinMode (6, OUTPUT)
pinMode (7, OUTPUT)
pinMode (8, OUTPUT)
pinMode (9, OUTPUT)
pinMode (10, OUTPUT);
pinMode (11, OUTPUT);
Serial.pinMode (9600);

for (int i = 0; i<NUMREADINGS i ++)
readings [i] = 0;
}
void loop () {
val = analogRead (probePin);
if (val>= 1) {

val = constrain (val, 1, senseLimit);
val = map (val, 1, senseLimit, 1, 1023);

total - = readings [index];

readings [index] = val;
total + = readings [index];
index = (index + 1);
if (index>= NUMREADINGS)

index = 0;

average = total / NUMREADINGS;

if (average> 50) {
digitalWrite (LED1, HIGH);
}
else {
digitalWrite (LED1, LOW);
}
if (average> 150) {
digitalWrite (LED2, HIGH);
}
else {
digitalWrite (LED2, LOW);
}
if (average> 250) {
digitalWrite (LED3, HIGH);
}
else {
digitalWrite (LED3, LOW);
}
if (average> 350) {
digitalWrite (LED4, HIGH);
}
else (
digitalWrite (LED4, LOW);
}
if (average> 450) {
digitalWrite (LED5, HIGH);
}
else {
digitalWrite (LED5, LOW);
}
if (average> 550) {
digitalWrite (LED6, HIGH);
}
else {
digitalWrite (LED6, LOW);

if (average> 650) {
digitalWrite (LED7, HIGH);
}
else {
digitalWrite (LED7, LOW);
if (average> 750) {
digitalWrite (LED8,
)
else {
digitalWrite (LED8, LOW);
if (average> 850) {
digitalWrite (LED9, HIGH);
}
else {
digitalWrite (LED9, LOW);
}
if (average> 950) {
digitalWrite (LED10, HIGH);
}
else {
digitalWrite (LED10, LOW);
}
Serial.println (val);
}
}


And the ERROR is knocked out in the line: average = total / NUMREADINGS;
Here's one: 'NUMREADINGS' was not declared in this scope

Thanks in advance if you can help.



Rep: (1090)
* PoluxTroy,
your constant is not defined NUMREADINGS
write at the beginning
#define NUMREADINGS x
where x is the number of ADC readings you need to store



Rep: (0)
Azathtot @ 03/10/19, 11:58*
your constant is not defined NUMREADINGS
write at the beginning
#define NUMREADINGS x
where x is the number of ADC readings you need to store

Thank you It helped, but there were also imperfections in the text ... everything corrected and everything worked.



Rep: (50)
Off-line @ 03/03/19, 14:03*
adding a neutral check algorithm.
if not difficult, can you write how you will implement a neutral check? I myself see only in the form of a magnetic cylinder and a chain of reed switches ...



Rep: (1090)
scl @ 03/11/19 00:12*
if not difficult, can you write how you will implement a neutral check?

Request ODB Service 01 PID 0xA4



Rep: (50)
Azathtot @ 03/11/19, 7:09*
Request ODB Service 01 PID 0xA4
what kind of obd? :) this is the mechanics :) the more so the old one, on my auto there is no obd :))



Rep: (1090)
scl @ 03/11/19, 02:58*
what kind of obd? :) this is the mechanics :) the more so the old one, on my auto there is no obd :))

If you have old mechanics, then yes, here you have a serious finish. Put limit switches on all transfers or something.
Hall sensors are also an interesting option, but you need to select them and a magnet.



Rep: (32)
scl @ 03/11/2019, 05:12*
I myself see only in the form of a magnetic cylinder and a chain of reed switches ...


We display a button that, when the engine is started, while holding for 2-3 seconds, turns on the ignition (without starting, respectively) with a 30 second timer
Turn off the ignition with the key and exit the car, the engine is running
After closing all the doors, the system turns off the ignition (turns off the engine) and sets the program key / flag, which is ready to start
If the door was opened during the parking process, the key / flag is thrown off but zero.
In the startup code, we monitor the status of the key.
Everything original is simple)

R.S. you need to make sure that all the door buttons are working !!!

Post has been editedoff-line - 11.03.19, 10:22



Rep: (50)
Off-line @ 03/11/19, 10:12*
We display a button that, when the engine is started, while holding for 2-3 seconds, turns on the ignition (without starting, respectively) with a 30 second timer
Turn off the ignition with the key and exit the car, the engine is running
After closing all the doors, the system turns off the ignition (turns off the engine) and sets the program key / flag, which is ready to start
If the door was opened during the parking process, the key / flag is thrown off but zero.
In the startup code, we monitor the status of the key.
Everything original is simple)

R.S. you need to make sure that all the door buttons are working !!!
it’s a logical neutral, I don’t trust her anymore, I got burned once on a tamahawk :)



Rep: (32)
scl @ 03/11/2019, 09:33*
it’s a logical neutral, I don’t trust her anymore, I got burned once on a tamahawk :)

It is very interesting how you can start the engine if the procedure is performed correctly?

This is the only 100% method subject to serviceable equipment IMHO
But reed switches or some other sensors can lie

In the code, it is still worth writing the key to zero when starting the program in case of a reboot

Post has been editedoff-line - 11.03.19, 12:45



Rep: (50)
Off-line @ 03/11/19, 11:47*
It is very interesting how you can start the engine if the procedure is performed correctly?

This is the only 100% method subject to serviceable equipment IMHO
But reed switches or some other sensors can lie

In the code, it is still worth writing the key to zero when starting the program in case of a reboot

Life example :)
Spring, autostart is not needed yet. New car, manual mechanic, tomahawk alarm with auto start.
I park the car in the evening, I do not carry out the neutral procedure, since it is warm, that is, I turn off the car, go out and close it. Since the car is simply muffled without a handbrake, even if you accidentally select the remote start mode, the car should not start. But what was my surprise when I discovered, or rather, at first I did not find a car, and only then I saw it resting on the curb. Came out, I hear the battery that is already dead is trying to crank the starter. As a result, it turned out that the signalization board burned out for some reason and closed the contacts of the starter relay without trying to start it, that is, without any checks, the starter started up corny and worked until I got out. It was lucky that there were holidays and there were no cars and what did not jump over the curb. As a result, under warranty, they changed both the signaling and the battery and starter. But after that, I never bet on speed, no matter if I needed a remote start or not. But the reed switches, the more connected in series, it seems to me that they will just be safer, it’s better to let them go down and not let them start, than vice versa :)



Rep: (32)
scl @ 03/11/2019, 12:40*
Life example :)

I am very sorry, but there is no connection with logistics neutral
If there were reed switches, then this would not have happened?

It's all about the installation. In your case, just one fuse would eliminate this problem.


Th my opinion is that logical neutral is the surest way

Post has been editedoff-line - 11.03.19, 14:20



Rep: (50)
Off-line @ 03/11/19, 14:19*
It's all about the installation. In your case, just one fuse would eliminate this problem.

Well, that is, the connection is indirect, and yes, there would be an additional fuse on the board, it would probably save the situation, but since most likely the signaling board was initially crookedly designed, the closely located melted relay contacts of the signaling circuit closed the wires from the auto starter relay. And the check as a result of logical neutral is simply ignored. But the contacts from the built-in relay for the auto starter relay could be passed through a chain of reed switches and then the starter would not have come on in any way due to the absence of mechanical closure of the two relays ..



Rep: (32)
scl @ 03/11/2019, 14:52*
But the contacts from the built-in relay for the auto starter relay could be passed through a chain of reed switches

I did not even take such a scheme into account)
The scheme seems to be working, but with debugging it will be very dreary. Good luck!

And I put a fuse on + reels and for a long time it will not last under load.

Post has been editedoff-line - 11.03.19, 16:30



Rep: (50)
Off-line @ 03/11/19, 16:28*
And I put a fuse on + reels and for a long time it will not last under load
for a long time, of course, but if the car is between two enough and a couple of seconds;))


Full version    

Help     rules

Now: 09/13/19, 19:12