This commit is contained in:
Peli de Halleux committed 2018-01-08 14:43:19 -08:00
commit 456df3c442
2 files changed
+18 -1

No files matched your search

+2 -1
View File
@@ -167,4 +167,5 @@
"description": "Activity 2", "description": "Activity 2",
"url":"/coding/roaming-2", "url":"/coding/roaming-2",
"cardType": "example" "cardType": "example"
}, { }]
```
+16
View File
@@ -0,0 +1,16 @@
```blocks
let lasterror = 0
let D = 0
let I = 0
let P = 0
let error = 0
loops.forever(function () {
error = sensors.color3.light(LightIntensityMode.Reflected) - 35
P = error * 5
I = I + error * 0.01
D = (error - lasterror) * 0.2
motors.largeBC.steer(P + (I + D), 100)
lasterror = error
})
```