sensor values in stabilizer.c
Posted: Sun Feb 07, 2016 10:03 pm
Hi,
I hope someone can help me with my goal. I want to include my infrarot sensor value in the stabilizer.c file for reaching that the sensor values enable the motor. I have include the parameter to enable the motors abd I have the driver from the sensor.
my sensor driver
what should i do that my range variable is defined in stabilizer.c?
I hope someone can help me with my goal. I want to include my infrarot sensor value in the stabilizer.c file for reaching that the sensor values enable the motor. I have include the parameter to enable the motors abd I have the driver from the sensor.
my sensor driver
Code: Select all
#include "deck.h"
#include "log.h"
#include "FreeRTOS.h"
#include "timers.h"
static xTimerHandle timer;
static float range;
void SensorValue(xTimerHandle timer)
{
range=analogRead(DECK_GPIO_TX2);
}
void mySensorInit(DeckInfo *info)
{
pinMode(DECK_GPIO_TX2,INPUT);
timer = xTimerCreate("irsensorTmr", M2T(100), pdTRUE, NULL, SensorValue);
xTimerStart(timer, 100);
}
static const DeckDriver mySensor_driver = {
.name = "myIrSensors",
.usedGpio = DECK_USING_TX2,
.init = mySensorInit
};
DECK_DRIVER(mySensor_driver);
LOG_GROUP_START(myIrSensors)
LOG_ADD(LOG_FLOAT, range, &range)
LOG_GROUP_STOP(myIrSensors)
what should i do that my range variable is defined in stabilizer.c?