<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA</id>
		<title>MicroMV 巡线机器人 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA&amp;action=history"/>
		<updated>2026-04-21T07:13:32Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA&amp;diff=26835&amp;oldid=prev</id>
		<title>2018年12月7日 (五) 03:42 502748957@qq.com</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA&amp;diff=26835&amp;oldid=prev"/>
				<updated>2018-12-07T03:42:02Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018年12月7日 (五) 03:42的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l168&quot; &gt;第168行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第168行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;MicroMV目录&lt;/del&gt;|返回MicroMV目录页面]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;MicroMV 简介&lt;/ins&gt;|返回MicroMV目录页面]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>502748957@qq.com</name></author>	</entry>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA&amp;diff=26085&amp;oldid=prev</id>
		<title>2018年5月16日 (三) 09:54 Radiumray9@gmail.com</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA&amp;diff=26085&amp;oldid=prev"/>
				<updated>2018-05-16T09:54:42Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018年5月16日 (三) 09:54的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l164&quot; &gt;第164行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第164行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[MicroMV目录|返回MicroMV目录页面]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Radiumray9@gmail.com</name></author>	</entry>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA&amp;diff=25905&amp;oldid=prev</id>
		<title>Radiumray9@gmail.com：创建页面，内容为“=='''基本原理'''== *MicroMV捕捉线并计算出需要旋转的角度，通过串口发送给microduino *microduino接收数据后控制舵机电机  =='''MicroM…”</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=MicroMV_%E5%B7%A1%E7%BA%BF%E6%9C%BA%E5%99%A8%E4%BA%BA&amp;diff=25905&amp;oldid=prev"/>
				<updated>2018-05-16T07:16:05Z</updated>
		
		<summary type="html">&lt;p&gt;创建页面，内容为“==&amp;#039;&amp;#039;&amp;#039;基本原理&amp;#039;&amp;#039;&amp;#039;== *MicroMV捕捉线并计算出需要旋转的角度，通过串口发送给microduino *microduino接收数据后控制舵机电机  ==&amp;#039;&amp;#039;&amp;#039;MicroM…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=='''基本原理'''==&lt;br /&gt;
*MicroMV捕捉线并计算出需要旋转的角度，通过串口发送给microduino&lt;br /&gt;
*microduino接收数据后控制舵机电机&lt;br /&gt;
&lt;br /&gt;
=='''MicroMV的代码准备'''==&lt;br /&gt;
把lineFollowing.py替换到MicroMV生成的U盘空间中的main.py做为主程序&amp;lt;br /&amp;gt;&lt;br /&gt;
lineFollowing.py:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;py&amp;quot;&amp;gt;&lt;br /&gt;
import sensor, image, time, math, lcd&lt;br /&gt;
from pyb import UART&lt;br /&gt;
import json&lt;br /&gt;
# Tracks a black line. Use [(128, 255)] for a tracking a white line.&lt;br /&gt;
# GRAYSCALE_THRESHOLD = [(0, 64)]&lt;br /&gt;
GRAYSCALE_THRESHOLD = [(0, 50)]&lt;br /&gt;
#设置阈值，如果是黑线，GRAYSCALE_THRESHOLD = [(0, 64)]；&lt;br /&gt;
#如果是白线，GRAYSCALE_THRESHOLD = [(128，255)]&lt;br /&gt;
# Each roi is (x, y, w, h). The line detection algorithm will try to find the&lt;br /&gt;
# centroid of the largest blob in each roi. The x position of the centroids&lt;br /&gt;
# will then be averaged with different weights where the most weight is assigned&lt;br /&gt;
# to the roi near the bottom of the image and less to the next roi and so on.&lt;br /&gt;
ROIS = [ # [ROI, weight]&lt;br /&gt;
        (0, 100, 160, 20, 0.7), # You'll need to tweak the weights for you app&lt;br /&gt;
        (0, 050, 160, 20, 0.3), # depending on how your robot is setup.&lt;br /&gt;
        (0, 000, 160, 20, 0.1)&lt;br /&gt;
       ]&lt;br /&gt;
#roi代表三个取样区域，（x,y,w,h,weight）,代表左上顶点（x,y）宽高分别为w和h的矩形，&lt;br /&gt;
#weight为当前矩形的权值。注意本例程采用的QQVGA图像大小为160x120，roi即把图像横分成三个矩形。&lt;br /&gt;
#三个矩形的阈值要根据实际情况进行调整，离机器人视野最近的矩形权值要最大，&lt;br /&gt;
#如上图的最下方的矩形，即(0, 100, 160, 20, 0.7)&lt;br /&gt;
# Compute the weight divisor (we're computing this so you don't have to make weights add to 1).&lt;br /&gt;
weight_sum = 0 #权值和初始化&lt;br /&gt;
for r in ROIS: weight_sum += r[4] # r[4] is the roi weight.&lt;br /&gt;
#计算权值和。遍历上面的三个矩形，r[4]即每个矩形的权值。&lt;br /&gt;
# Camera setup...&lt;br /&gt;
sensor.reset() # Initialize the camera sensor.&lt;br /&gt;
sensor.set_pixformat(sensor.GRAYSCALE) # use grayscale.&lt;br /&gt;
sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.&lt;br /&gt;
sensor.skip_frames(30) # Let new settings take affect.&lt;br /&gt;
sensor.set_auto_gain(False) # must be turned off for color tracking&lt;br /&gt;
sensor.set_auto_whitebal(False) # must be turned off for color tracking&lt;br /&gt;
#关闭白平衡&lt;br /&gt;
clock = time.clock() # Tracks FPS.&lt;br /&gt;
lcd.init() # Initialize the lcd screen.&lt;br /&gt;
uart = UART(4, 115200)&lt;br /&gt;
uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters&lt;br /&gt;
while(True):&lt;br /&gt;
    clock.tick() # Track elapsed milliseconds between snapshots().&lt;br /&gt;
    img = sensor.snapshot() # Take a picture and return the image.&lt;br /&gt;
    centroid_sum = 0&lt;br /&gt;
    #利用颜色识别分别寻找三个矩形区域内的线段&lt;br /&gt;
    for r in ROIS:&lt;br /&gt;
        blobs = img.find_blobs(GRAYSCALE_THRESHOLD, roi=r[0:4], merge=True)&lt;br /&gt;
        # r[0:4] is roi tuple.&lt;br /&gt;
        #找到视野中的线,merge=true,将找到的图像区域合并成一个&lt;br /&gt;
        #目标区域找到直线&lt;br /&gt;
        if blobs:&lt;br /&gt;
            # Find the index of the blob with the most pixels.&lt;br /&gt;
            most_pixels = 0&lt;br /&gt;
            largest_blob = 0&lt;br /&gt;
            for i in range(len(blobs)):&lt;br /&gt;
            #目标区域找到的颜色块（线段块）可能不止一个，找到最大的一个，作为本区域内的目标直线&lt;br /&gt;
                if blobs[i].pixels() &amp;gt; most_pixels:&lt;br /&gt;
                    most_pixels = blobs[i].pixels()&lt;br /&gt;
                    #merged_blobs[i][4]是这个颜色块的像素总数，如果此颜色块像素总数大于                     #most_pixels，则把本区域作为像素总数最大的颜色块。更新most_pixels和largest_blob&lt;br /&gt;
                    largest_blob = i&lt;br /&gt;
            # Draw a rect around the blob.&lt;br /&gt;
            img.draw_rectangle(blobs[largest_blob].rect())&lt;br /&gt;
            #将此区域的像素数最大的颜色块画矩形和十字形标记出来&lt;br /&gt;
            img.draw_cross(blobs[largest_blob].cx(),&lt;br /&gt;
                           blobs[largest_blob].cy())&lt;br /&gt;
            centroid_sum += blobs[largest_blob].cx() * r[4] # r[4] is the roi weight.&lt;br /&gt;
            #计算centroid_sum，centroid_sum等于每个区域的最大颜色块的中心点的x坐标值乘本区域的权值&lt;br /&gt;
    center_pos = (centroid_sum / weight_sum) # Determine center of line.&lt;br /&gt;
    #中间公式&lt;br /&gt;
    # Convert the center_pos to a deflection angle. We're using a non-linear&lt;br /&gt;
    # operation so that the response gets stronger the farther off the line we&lt;br /&gt;
    # are. Non-linear operations are good to use on the output of algorithms&lt;br /&gt;
    # like this to cause a response &amp;quot;trigger&amp;quot;.&lt;br /&gt;
    deflection_angle = 0&lt;br /&gt;
    #机器人应该转的角度&lt;br /&gt;
    # The 80 is from half the X res, the 60 is from half the Y res. The&lt;br /&gt;
    # equation below is just computing the angle of a triangle where the&lt;br /&gt;
    # opposite side of the triangle is the deviation of the center position&lt;br /&gt;
    # from the center and the adjacent side is half the Y res. This limits&lt;br /&gt;
    # the angle output to around -45 to 45. (It's not quite -45 and 45).&lt;br /&gt;
    deflection_angle = -math.atan((center_pos-80)/60)&lt;br /&gt;
    #角度计算.80 60 分别为图像宽和高的一半，图像大小为QQVGA 160x120.&lt;br /&gt;
    #注意计算得到的是弧度值&lt;br /&gt;
    # Convert angle in radians to degrees.&lt;br /&gt;
    deflection_angle = math.degrees(deflection_angle)&lt;br /&gt;
    #将计算结果的弧度值转化为角度值&lt;br /&gt;
    # Now you have an angle telling you how much to turn the robot by which&lt;br /&gt;
    # incorporates the part of the line nearest to the robot and parts of&lt;br /&gt;
    # the line farther away from the robot for a better prediction.&lt;br /&gt;
    # print(&amp;quot;Turn Angle: %f&amp;quot; % deflection_angle)&lt;br /&gt;
    if center_pos!=0:&lt;br /&gt;
        output_str=json.dumps([deflection_angle])&lt;br /&gt;
    else:&lt;br /&gt;
        output_str=json.dumps([0])&lt;br /&gt;
    # output_str=json.dumps([deflection_angle])&lt;br /&gt;
    print('you send:',output_str)&lt;br /&gt;
    uart.write(output_str+'\n')&lt;br /&gt;
    # uart.write(deflection_angle+'\n')&lt;br /&gt;
    #将结果打印在terminal中&lt;br /&gt;
    lcd.display(img)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
IDE运行效果为&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:microMVLineFollowing1.png||600px|left]]&amp;lt;br style=&amp;quot;clear: left&amp;quot;/&amp;gt;&lt;br /&gt;
屏幕中会对线进行标注&lt;br /&gt;
&lt;br /&gt;
=='''Microduino的代码准备'''==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;py&amp;quot;&amp;gt;&lt;br /&gt;
#define my_Serial Serial1&lt;br /&gt;
#define servoPin  6&lt;br /&gt;
#define LEDPin 4&lt;br /&gt;
#include &amp;lt;Servo.h&amp;gt;&lt;br /&gt;
#include &amp;lt;Microduino_ColorLED.h&amp;gt; //引用彩灯库&lt;br /&gt;
static const uint8_t carPinForward = 8;&lt;br /&gt;
static const uint8_t carPinBackward = 9;&lt;br /&gt;
uint8_t carPower=40;&lt;br /&gt;
// uint8_t carPower=0;&lt;br /&gt;
Servo myservo;&lt;br /&gt;
String degreeStr;&lt;br /&gt;
int pos=0;&lt;br /&gt;
int lastPos=0;&lt;br /&gt;
ColorLED strip = ColorLED(1, LEDPin);&lt;br /&gt;
void setup() { &lt;br /&gt;
  Serial.begin(115200); &lt;br /&gt;
  my_Serial.begin(115200);&lt;br /&gt;
  myservo.attach(servoPin); &lt;br /&gt;
  strip.begin();&lt;br /&gt;
  strip.setBrightness(60);&lt;br /&gt;
  strip.setPixelColor(0, strip.Color(255, 255, 255));&lt;br /&gt;
  strip.show();&lt;br /&gt;
  pinMode(carPinForward, OUTPUT);&lt;br /&gt;
  digitalWrite(carPinForward, LOW);&lt;br /&gt;
  pinMode(carPinBackward, OUTPUT);&lt;br /&gt;
  digitalWrite(carPinBackward, LOW);&lt;br /&gt;
} &lt;br /&gt;
void loop() {&lt;br /&gt;
  if (my_Serial.available() &amp;gt; 0) {&lt;br /&gt;
    degreeStr = my_Serial.readStringUntil('\n');&lt;br /&gt;
    uint8_t len=degreeStr.length();&lt;br /&gt;
    degreeStr=degreeStr.substring(1,len-1);&lt;br /&gt;
    pos=degreeStr.toInt();&lt;br /&gt;
  Serial.println(pos);&lt;br /&gt;
    if(pos!=0) {&lt;br /&gt;
      pos = map(pos, -50, 50, 30, 130);&lt;br /&gt;
      myservo.write(pos);&lt;br /&gt;
      lastPos=pos;&lt;br /&gt;
    } else {&lt;br /&gt;
      if(lastPos&amp;gt;80) {&lt;br /&gt;
        myservo.write(130);&lt;br /&gt;
      }else {&lt;br /&gt;
        myservo.write(30);&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  uint8_t detlaSpeed=0;&lt;br /&gt;
  uint8_t detlaSpeed=abs(pos-80);&lt;br /&gt;
  detlaSpeed=map(detlaSpeed,0,50,0,7);&lt;br /&gt;
  analogWrite(carPinForward, carPower-detlaSpeed);&lt;br /&gt;
  digitalWrite(carPinBackward, LOW);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Radiumray9@gmail.com</name></author>	</entry>

	</feed>