From: Leandro Lucarella Date: Sun, 17 Dec 2006 19:07:28 +0000 (+0000) Subject: El sensor ahora devuelve valor binario (0 si no tiene nada adelante, 1 si sí tiene). X-Git-Tag: entrega-20061218~13 X-Git-Url: https://git.llucax.com/z.facultad/75.68/celdas.git/commitdiff_plain/e800bc42e811087efc35350d5bfaa97cd1926d88 El sensor ahora devuelve valor binario (0 si no tiene nada adelante, 1 si sí tiene). --- diff --git a/trunk/src/breve/Celdas.tz b/trunk/src/breve/Celdas.tz index 0d3ced5..ce5d511 100644 --- a/trunk/src/breve/Celdas.tz +++ b/trunk/src/breve/Celdas.tz @@ -211,10 +211,10 @@ CeldasLightVehicle : CeldasVehicle (aka CeldasVehicles) { return (fSensor get-sensor-value). +to update-entorno: - entorno{"sensor_f"} = (fSensor get-data). - entorno{"sensor_b"} = (bSensor get-data). - entorno{"sensor_r"} = (rSensor get-data). - entorno{"sensor_l"} = (lSensor get-data). + entorno{"sensor_f"} = (fSensor get-sensor-value). + entorno{"sensor_b"} = (bSensor get-sensor-value). + entorno{"sensor_r"} = (rSensor get-sensor-value). + entorno{"sensor_l"} = (lSensor get-sensor-value). entorno{"movido"} = 0. # TODO sa update-entorno with entorno. @@ -523,6 +523,11 @@ Link : CeldasSensor (aka CeldasSensors) { % Gets the sensor value. This should be used from post-iterate, % if not, the sensor reading correspond to the previous % iteration. + val (float). + + val = self get-data. + if (val > 10): return 0. + else return 1. #+ to iterate: