@@ -25,22 +25,11 @@ require 'ev3dev'
2525
2626function printMotorInfo (o )
2727 print (" Current state is " .. o :state ())
28- print (" duty cycle: " .. o :dutyCycle ().. " pulses/sec: " .. o :pulsesPerSecond ().. " \n " )
29- print (" Current run mode is " .. o :runMode ())
30- print (" stop mode: " .. o :stopMode ())
31- print (" regulation mode: " .. o :regulationMode ().. " \n " )
32- -- print(" Speed setpoint is "..o:speedSetpoint())
33-
34- if (o :runMode () == o .runModeTime ) then
35- print (" Time setpoint is " .. o :timeSetpoint ())
36- end
37-
38- if (o :runMode () == o .runModePosition ) then
39- print (" Position setpoint is " .. o :positionSetpoint ())
40- end
41-
42- -- print(" ramp up: "..o:rampUp().." ramp down: "..o:rampDown())
43-
28+ print (" duty cycle: " .. o :dutyCycle ())
29+ print (" speed: " .. o :speed ())
30+ print (" position: " .. o :position ())
31+ print (" stop command: " .. o :stopCommand ())
32+ print (" speed regulation: " .. o :speedRegulationEnabled ())
4433end
4534
4635s = TouchSensor ()
@@ -55,7 +44,7 @@ ic = I2CSensor()
5544if (ic :connected ()) then
5645 print (" Connected to I2C sensor @ " .. c :portName ().. " with mode " .. c :mode ())
5746 print (" Value is " .. c :value ())
58- if (c :dp () > 0 ) then
47+ if (c :decimals () > 0 ) then
5948 print (" Float value is " .. c :floatValue ())
6049 end
6150else
@@ -66,7 +55,7 @@ c = ColorSensor()
6655if (c :connected ()) then
6756 print (" Connected to color sensor @ " .. c :portName ().. " with mode " .. c :mode ())
6857 print (" Value is " .. c :value ())
69- if (c :dp () > 0 ) then
58+ if (c :decimals () > 0 ) then
7059 print (" Float value is " .. c :floatValue ())
7160 end
7261else
@@ -77,7 +66,7 @@ u = UltrasonicSensor()
7766if (u :connected ()) then
7867 print (" Connected to ultrasonic sensor @ " .. u :portName ().. " with mode " .. u :mode ())
7968 print (" Value is " .. u :value ())
80- if (u :dp () > 0 ) then
69+ if (u :decimals () > 0 ) then
8170 print (" Float value is " .. u :floatValue ())
8271 end
8372else
@@ -88,7 +77,7 @@ g = GyroSensor()
8877if (g :connected ()) then
8978 print (" Connected to gyro sensor @ " .. g :portName ().. " with mode " .. g :mode ())
9079 print (" Value is " .. g :value ())
91- if (g :dp () > 0 ) then
80+ if (g :decimals () > 0 ) then
9281 print (" Float value is " .. g :floatValue ())
9382 end
9483else
@@ -99,7 +88,7 @@ i = InfraredSensor()
9988if (i :connected ()) then
10089 print (" Connected to IR sensor @ " .. i :portName ().. " with mode " .. i :mode ())
10190 print (" Value is " .. i :value ())
102- if (i :dp () > 0 ) then
91+ if (i :decimals () > 0 ) then
10392 print (" Float value is " .. i :floatValue ())
10493 end
10594else
@@ -166,7 +155,7 @@ if (ledPFoutD:connected()) then
166155end
167156
168157print (" Beeping..." )
169- Sound .beep ();
158+ -- Sound.beep();
170159
171160print (" Sound volume is " .. Sound .volume ())
172161
0 commit comments