Car::Car() : m_leds{Led(0), Led(1), Led(2), Led(3)}, m_uart(3, 115200), m_motor1(0), m_motor2(1), #ifdef LIBSC_USE_CAMERA m_cam(CAM_W, CAM_H), #endif m_accel(RXADC), m_lcd(true), m_start_button(0), m_joystick(0), m_balancevolt(LIBSC_VOLT) { #ifdef LIBSC_USE_UART m_uart.StartReceive(); libutil::InitDefaultFwriteHandler(&m_uart); #endif #ifdef LIBSC_USE_CAMERA while (!m_cam.Init()) { LOG_E("Camera f****d up!!!!!"); DELAY_MS(250); } m_cam.ShootContinuously(); #endif #ifdef LIBSC_USE_K60_ENCODERS FTM_QUAD_Init(FTM1); FTM_QUAD_Init(FTM2); #endif }
Car::Car() :m_encoder{Encoder(0), Encoder(1)}, m_servo(0), m_lcd(true), m_lcd_console(&m_lcd), m_leds{Led(0), Led(1), Led(2), Led(3)}, m_motor{Motor(0), Motor(1)}, m_uart(3, libbase::k60::Uart::Config::BaudRate::BR_115200) { SetMotorPowerLeft(0); SetMotorPowerRight(0); SetMotorDirection(true); m_servo.SetDegree(SERVO_MID_DEGREE); m_uart.EnableRx(); }
/** * Add a led to the environment * * @param eye right eye #EYE_RIGHT or left #EYE_LEFT * @param position Physical position of the LEDs in the eye camera coordinate system */ inline void addLed(unsigned int eye, cv::Point3d position){ if( eye > EYE_MAX ){ return; } else{ _leds[eye].push_back(Led(_leds[eye].size(),position)); _num_leds[eye]++; } }
//const char nmotor[] = {"Motor"}; int streamProcess(char *recebuffer) { char *p; if(NULL == (p=findValueByName(recebuffer,nbuzzer))) return -1; printf("Buzzer:%s\n",p); Buzzer(p); if(NULL == (p=findValueByName(recebuffer,nled))) return -1; printf("Led:%s\n",p); Led(p); return 1; }
namespace Light { // VARIABLES // Thread states static WORKING_AREA(lightThreadArea, 256); bool _isStarted = false; bool _isInitialized = false; uint8_t _threadDelay = 20; // Led objects uint8_t HEART_LED_RED_PIN = 11; uint8_t HEART_LED_GREEN_PIN = 12; uint8_t HEART_LED_BLUE_PIN = 13; Led leds[N_LEDS] = { Led(HEART_LED_RED_PIN, HEART_LED_GREEN_PIN, HEART_LED_BLUE_PIN) }; Queue<LedData*> data[N_LEDS] = { Queue<LedData*>() }; // Misc Semaphore _sem = _SEMAPHORE_DATA(_sem, 0); }
LedStrip::LedStrip(int r_pin, int g_pin, int b_pin,bool invertPWM) { led_r = Led(r_pin, invertPWM); led_g = Led(g_pin, invertPWM); led_b = Led(b_pin, invertPWM); }
//## class Led Led::Led() { NOTIFY_CONSTRUCTOR(Led, Led(), 0, System_Led_Led_SERIALIZE); }
#include "Lib.h" Led lc = Led(10,12,11,1); void Init() { lc.shutdown(0,false); // Wake up displays lc.setIntensity(0,0); // Set intensity levels lc.clearDisplay(0); // Clear Displays } void draw(const uint8_t *frame, uint8_t numRow) { for(uint8_t i = 0; i < numRow; i++) { lc.setRow(0, i, frame[i]); } } void draw(const uint8_t *frame, uint8_t numRow, uint8_t x, uint8_t y) { uint8_t newFrame[numRow]; for(uint8_t i = 0; i < numRow; i++) { newFrame[i] = frame[i] >> x; } for(uint8_t j = 0; j < numRow; j++) { lc.setRow(0, j + y, newFrame[j]); } } void draw(uint16_t number) { uint8_t donvi = number%10; uint8_t chuc = (number%100)/10; uint8_t tram = (number%1000)/100; uint8_t nghin = number/1000;
Car::Car() : m_leds{Led(0), Led(1), Led(2), Led(3)}, m_uart(3, 115200) { m_uart.StartReceive(); }
/** * @brief Instantiates a new led, given its red, green and blue pins and a starting color * @param redPin the red pin * @param greenPin the green pin * @param bluePin the blue pin * @param color the start color */ Led::Led(uint8_t redPin, uint8_t greenPin, uint8_t bluePin, Color colorValue) { Led(redPin, greenPin, bluePin); _colorValue = colorValue; }
* Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the "Software"), * * to deal in the Software without restriction, including without limitation * * the rights to use, copy, modify, merge, publish, distribute, sublicense, * * and/or sell copies of the Software, and to permit persons to whom the * * Software is furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * You should have received a copy of The MIT License (MIT) along with this * * program. If not, see <http://opensource.org/licenses/MIT/>. * ******************************************************************************/ #include "LedManager.h" // Initializations Led LedManager::errorLed = Led(ERROR_LED_PIN, ERROR_LED_ANALOG); Led LedManager::statusLed = Led(STATUS_LED_PIN, STATUS_LED_ANALOG); void LedManager::setup() { // Set up the LEDs LedManager::errorLed.setupPin(); LedManager::statusLed.setupPin(); } void LedManager::update() { // Update all LEDs LedManager::errorLed.update(); LedManager::statusLed.update(); }