Добрый день.
А чем отличаются в управлении регулятор хода и сервопривод?
Добрый. Основная проблема с тормозом и задним ходом, дать понять ардуино как правильно управлять этим эллементом
Добрый. Основная проблема с тормозом и задним ходом, дать понять ардуино как правильно управлять этим эллементом
Центр сервы (1500) = тормоз регулятора.
Полное отклонение сервы назад (0) = полный газ назад.
Полное отклонение сервы вперед (2000) = полный газ вперед.
Вот парсер serial для такой строки
var0,var1,var2,var3.var0,var1,var2,var3.var0,var1,var2,var3.
Переменные через зпт, окончание - тчк.
#include <string.h> // we'll need this for subString
#include <SoftwareSerial.h>
SoftwareSerial MODEM_serial(7, 8); // RX, TX
const char EOPmarker = '.'; //This is the end of packet marker
char serialbuf[32]; //This gives the incoming serial some room. Change it if you want a longer incoming.
#define MAX_STRING_LEN 20 // like 3 lines above, change as needed.
if (MODEM_serial.available() > 0) { //makes sure something is ready to be read
static int bufpos = 0; //starts the buffer back at the first position in the incoming serial.read
char inchar = MODEM_serial.read(); //assigns one byte (as serial.read()'s only input one byte at a time
if (inchar != EOPmarker) { //if the incoming character is not the byte that is the incoming package ender
serialbuf[bufpos] = inchar; //the buffer position in the array get assigned to the current read
bufpos++; //once that has happend the buffer advances, doing this over and over again until the end of package marker is read.
}
else { //once the end of package marker has been read
serialbuf[bufpos] = 0; //restart the buff
bufpos = 0; //restart the position of the buff
motionDetection_raw = atoi(subStr(serialbuf, ",", 1));
accel_X_raw = atoi(subStr(serialbuf, ",", 2));
accel_Y_raw = atoi(subStr(serialbuf, ",", 3));
accel_Z_raw = atoi(subStr(serialbuf, ",", 4));
Serial.println();
Serial.print("md=");
Serial.print(motionDetection_raw, DEC);
Serial.print(" x=");
Serial.print(accel_X_raw, DEC);
Serial.print(" y=");
Serial.print(accel_Y_raw, DEC);
Serial.print(" z=");
Serial.print(accel_Z_raw, DEC);
Serial.println();
}
}
Спец.функция в главном скетче:
char* subStr (char* input_string, char *separator, int segment_number) {
char *act, *sub, *ptr;
static char copy[MAX_STRING_LEN];
int i;
strcpy(copy, input_string);
for (i = 1, act = copy; i <= segment_number; i++, act = NULL) {
sub = strtok_r(act, separator, &ptr);
if (sub == NULL) break;
}
return sub;
}
Musgravehill
Очень интересно, большое спасибо. Вечером буду пробовать
При тесте вместо регулятора удобно использовать серву, чтобы не гонять мотор, а просто смотреть на положение качалки.
Для быстро собрать есть готовая оболочка: remotexy.com/ru/
Ребенок делает лего игрушки, я ему сделал модуль на ардуинке:
Добрый день.
А чем отличаются в управлении регулятор хода и сервопривод?
На многих регуляторах задний ход включается после тормоза. То есть вначале надо затормозить, а после уже ехать назад. Это сделано для сохранения трансмиссии. Если регулятор можно настраивать, то можно поставить режим вперед/назад без тормоза.
{"assets_hash":"a8b26fa7f6e768b07a72c8c9aadb9422","page_data":{"users":{"424023783df955007779199a":{"_id":"424023783df955007779199a","hid":6565,"name":"AlexeyOleynikov","nick":"AlexeyOleynikov","avatar_id":null,"css":""},"4d010d823df9550077758ea5":{"_id":"4d010d823df9550077758ea5","hid":76212,"name":"l1511","nick":"l1511","avatar_id":null,"css":""},"4d2c233c3df9550077757a39":{"_id":"4d2c233c3df9550077757a39","hid":78027,"name":"Musgravehill","nick":"Musgravehill","avatar_id":null,"css":""},"507728773df955007773ee3c":{"_id":"507728773df955007773ee3c","hid":127104,"name":"NBystrov","nick":"NBystrov","avatar_id":null,"css":""},"515a77563df955007773812a":{"_id":"515a77563df955007773812a","hid":146119,"name":"kabuum","nick":"kabuum","avatar_id":null,"css":""}},"settings":{"can_see_ip":false,"can_report_abuse":false,"can_see_hellbanned":false,"forum_can_view":true,"forum_can_reply":false,"forum_edit_max_time":30,"forum_can_close_topic":false,"forum_show_ignored":false,"forum_mod_can_delete_topics":false,"forum_mod_can_hard_delete_topics":false,"forum_mod_can_see_hard_deleted_topics":false,"forum_mod_can_edit_posts":false,"forum_mod_can_pin_topic":false,"forum_mod_can_edit_titles":false,"forum_mod_can_close_topic":false,"can_vote":false,"forum_mod_can_add_infractions":false,"forum_topic_title_min_length":10,"forum_reply_old_post_threshold":30,"votes_add_max_time":168,"forum_show_post_interval":7,"can_see_deleted_users":false},"section":{"_id":"61c9a54c3df9550077bb50ba","hid":8,"title":"Самодельная электроника, компьютерные программы","parent":"61c9a54c3df9550077bb50f3","description":"Софт для моделирования и черчения, самодельные электронные устройства.","is_category":false,"is_votable":true,"is_writable":true,"cache":{"topic_count":2667,"post_count":48274,"last_post":"6757f71af9bb00ab89de832d","last_topic":"6757f71af9bb00ab89de832c","last_topic_hid":572572,"last_topic_title":"DVB-T2 для FPV видео","last_ts":"2024-12-10T08:08:58.227Z","last_user":"5b0062d13df95500776fe377"}},"topic":{"_id":"5a8c78843df9550077cbebcd","hid":517102,"title":"Машина на arduino","views_count":1935,"last_post_counter":8,"cache":{"post_count":8,"first_post":"5a8c78843df9550077cbf215","first_ts":"2018-02-20T19:35:32.000Z","first_user":"507728773df955007773ee3c","last_post":"5a8f88c73df9550077cbf223","last_post_hid":8,"last_ts":"2018-02-23T03:21:43.000Z","last_user":"515a77563df955007773812a"},"st":1,"section":"61c9a54c3df9550077bb50ba"},"subscription":null,"pagination":{"total":8,"per_page":25,"chunk_offset":2},"posts_list_before_post":["paginator","datediff"]},"locale":"en-US","user_id":"000000000000000000000000","user_hid":0,"user_name":"","user_nick":"","user_avatar":null,"is_member":false,"settings":{"can_access_acp":false,"can_use_dialogs":false,"hide_heavy_content":false},"unread_dialogs":false,"footer":{"rules":{"to":"common.rules"},"contacts":{"to":"rco-nodeca.contacts"}},"navbar":{"tracker":{"to":"users.tracker","autoselect":false,"priority":10},"forum":{"to":"forum.index"},"blogs":{"to":"blogs.index"},"clubs":{"to":"clubs.index"},"market":{"to":"market.index.buy"}},"recaptcha":{"public_key":"6LcyTs0dAAAAADW_1wxPfl0IHuXxBG7vMSSX26Z4"},"layout":"common.layout"}
We use cookies and web analytics services. By continuing to use our
website, you consent to the use of cookies or similar technologies on
this website, including third-party statistics and web analytics services,
which may in some cases collect and process information about your visit
and activity. To find out more, see rules of this website.