Demo entry 6789050

arduino header

   

Submitted by anonymous on Apr 25, 2019 at 06:45
Language: Arduino. Code size: 1.2 kB.

#include <math.h>

// const chars
const char WAITING_FOR_CONNECT[] = "Please connect";
const char INITING[] = "Initing......";
const char END[] = "End testing";
const char END_WITH_GRADE[] = "Your grade: %.2f";
// command
const char CHANGE_DEVICE_NAME_CMD[] = "AT+NAME=light-tester";
const char RESET_CMD[] = "AT+RST";
// directions
const int DIRECT_DOWN = 0;
const int DIRECT_UP = 1;
const int DIRECT_RIGHT = 2;
const int DIRECT_LEFT = 3;
// json keys
const char DIRECT_KEY[] = "d";
const char SCALE_KEY[] = "s";
const char CODE_KEY[] = "c";
const char GRADE_KEY[] = "g";
// ratio
const double MAX_HEIGHT_RATIO = 0.8;
const int DUTY_RATIO = 5;
// limits
const double MAX_SCALE = 1.00;
const double MIN_SCLAE = -0.30;
// protocal
const int SUCCESS_CODE = 0;
const int END_CODE = 2;
// error code
const int ERR_SMALL_SCALE = 401;
const int ERR_LARGE_SCALE = 402;
// device OLED12864
const double PIXEL_SIZE = 0.154; //pixel size: 0.154 mm
const double RHO = 2.90888e-4;   //弧度数
// distance
const int DISTANCE = 2500; //distance mm
// 根据放缩值,求box的大小
double get_size(double scale)
{
	return DUTY_RATIO * pow(10, scale) * DISTANCE * RHO;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).