本文整理汇总了C++中DEBUG_PRINTLN函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUG_PRINTLN函数的具体用法?C++ DEBUG_PRINTLN怎么用?C++ DEBUG_PRINTLN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEBUG_PRINTLN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: digitalWrite
// Apply all station bits
// !!! This will activate/deactivate valves !!!
void OpenSprinkler::apply_all_station_bits() {
digitalWrite(PIN_SR_LATCH, LOW);
byte bid, s, sbits;
bool engage_booster = false;
#if defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__)
// old station bits
static byte old_station_bits[MAX_EXT_BOARDS+1];
#endif
// Shift out all station bit values
// from the highest bit to the lowest
for(bid=0;bid<=MAX_EXT_BOARDS;bid++) {
if (status.enabled)
sbits = station_bits[MAX_EXT_BOARDS-bid];
else
sbits = 0;
#if defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__)
// check if any station is changing from 0 to 1
// take the bit inverse of the old status
// and with the new status
if ((~old_station_bits[MAX_EXT_BOARDS-bid]) & sbits) {
engage_booster = true;
}
old_station_bits[MAX_EXT_BOARDS-bid] = sbits;
#endif
for(s=0;s<8;s++) {
digitalWrite(PIN_SR_CLOCK, LOW);
#if defined(OSPI) // if OSPi, use dynamically assigned pin_sr_data
digitalWrite(pin_sr_data, (sbits & ((byte)1<<(7-s))) ? HIGH : LOW );
#else
digitalWrite(PIN_SR_DATA, (sbits & ((byte)1<<(7-s))) ? HIGH : LOW );
#endif
digitalWrite(PIN_SR_CLOCK, HIGH);
}
}
#if defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__)
if((hw_type==HW_TYPE_DC) && engage_booster) {
DEBUG_PRINTLN(F("engage booster"));
// boost voltage
digitalWrite(PIN_BOOST, HIGH);
delay(250);
digitalWrite(PIN_BOOST, LOW);
// enable boosted voltage for a short period of time
digitalWrite(PIN_BOOST_EN, HIGH);
digitalWrite(PIN_SR_LATCH, HIGH);
delay(500);
digitalWrite(PIN_BOOST_EN, LOW);
} else {
digitalWrite(PIN_SR_LATCH, HIGH);
}
#else
digitalWrite(PIN_SR_LATCH, HIGH);
#endif
}
示例2: DEBUG_PRINT
//<ID>, <TD01>, START ,<int: tag1>,<int: tag2>,<int: tag3>,<int: tag4>
void Theft::TheftDetectionFunction(int id, int command){
DEBUG_PRINT("#In the TheftDetectionFunction with function : '");
DEBUG_PRINT(command);
DEBUG_PRINT("' and with ID: ");
DEBUG_PRINTLN(id);
switch (command) {
case START:
rfid.RFIDFunctionSetup(); // Read and set rfid tag from serial
rfid.RFID_ENABLED = 1;
//button.BUTTON_ENABLED = 1; // Enables button
this->THEFT_ENABLED = 1;
break;
case STOP:
this->THEFT_ENABLED = 0; // Disable Theft Mode
//button.BUTTON_ENABLED = 0; // Disable Button
led.LEDFunctionSet(1,0); // Turn off LED
rfid.RFID_ENABLED = 0;
break;
default:
break;
}
}
示例3: do_setup
void do_setup() {
initialiseEpoch(); // initialize time reference for millis() and micros()
os.begin(); // OpenSprinkler init
os.options_setup(); // Setup options
pd.init(); // ProgramData init
if (os.start_network()) { // initialize network
DEBUG_PRINTLN("network established.");
os.status.network_fails = 0;
} else {
DEBUG_PRINTLN("network failed.");
os.status.network_fails = 1;
}
os.status.req_network = 0;
}
示例4: microsecondsToClockCycles
DHT::DHT(void) {
_maxCycles = microsecondsToClockCycles(DHT_MAX_CYCLES);
_lastTemperature = _lastHumidity = 0;
ADD_BIT(_status, STATUS_TEMP_GOOD | STATUS_HUMI_GOOD);
DEBUG_PRINTLN("DHT loaded.");
}
示例5: INT2MM2
int64_t WallOverlapComputation::overlapEndingDistance(Point& a1, Point& a2, Point& b1, Point& b2, int a1b1_dist)
{
int overlap = lineWidth - a1b1_dist;
Point a = a2-a1;
Point b = b2-b1;
double cos_angle = INT2MM2(dot(a, b)) / vSizeMM(a) / vSizeMM(b);
// result == .5*overlap / tan(.5*angle) == .5*overlap / tan(.5*acos(cos_angle))
// [wolfram alpha] == 0.5*overlap * sqrt(cos_angle+1)/sqrt(1-cos_angle)
// [assuming positive x] == 0.5*overlap / sqrt( 2 / (cos_angle + 1) - 1 )
if (cos_angle <= 0)
{
return 0;
}
else
{
int64_t dist = overlap * double ( 1.0 / (2.0 * sqrt(2.0 / (cos_angle+1.0) - 1.0)) );
if (dist * dist > vSize2(a) || dist * dist > vSize2(b))
{
return 0;
DEBUG_PRINTLN("ERROR! overlap end too long!! ");
}
return dist;
}
}
示例6: DEBUG_PRINT
void UPnPDeviceWiFiSwitch::onSetSwitchState(bool bState)
{
DEBUG_PRINT("Request state is ");
DEBUG_PRINT(String(bState));
DEBUG_PRINTLN("");
mSwitchStatus = bState ? true : false;
}
示例7: pinMode
// Function called in void setup() that instantiates all the variables, attaches pins, ect
// This funciton needs to be called before anything else will work
void Communicator::initialize() {
pinMode(TX_TO_DISCONNECT, INPUT); // Ensure it's in high impedance state
pinMode(RX_TO_DISCONNECT, INPUT); // Ensure it's in high impedance state
#ifdef DEBUG_COMMUNICATOR
SerialUSB.begin(SERIAL_USB_BAUD); // This is to computer
DEBUG_PRINTLN("at start of comm initialize");
#endif
// Set initial values to 0
altitude = 0;
//roll = 0; pitch = 0;
altitudeAtDrop = 0;
// Start without hardware attached
dropBayAttached = 0;
// Initialize serial commuication to Xbee.
XBEE_SERIAL.begin(XBEE_BAUD); //this is to Xbee
//Setup the GPS
setupGPS();
}
示例8: loop
void loop() {
if (Serial) {
if (!serialConnected) {
serialConnected = true;
DEBUG_PRINT(F("LongName: "));
DEBUG_PRINTLN(BleLongName);
}
} else {
if (serialConnected)
serialConnected = false;
}
// poll peripheral
blePeripheral.poll();
if (valueCharacteristic.subscribed()) {
int sensorValue = 0;
if (pin_type == ANALOG) {
sensorValue = analogRead(pin);
} else if (pin_type == DIGITAL) {
sensorValue = digitalRead(pin);
} else {
sensorValue = 666;
}
send_data(valueCharacteristic, millis(), sensorValue);
}
#ifdef GOOSCI_DEVELOPER_MODE
heartbeat();
#endif
}
示例9: if
bool NeoClock::process( bool changingModes )
{
_wheel.setPixelColor(sec, 0);
_wheel.setPixelColor(min, 0);
_wheel.setPixelColor(hr, 0);
sec = _currentTime.second() / 5;
min = _currentTime.minute() / 5;
hr = _currentTime.hour() % 12;
_wheel.setPixelColor(sec, _secColor);
_wheel.setPixelColor(min, _minColor);
_wheel.setPixelColor(hr, _hrColor);
if ( sec == min && sec == hr )
_wheel.setPixelColor(sec, _secColor | _minColor | _hrColor );
else if ( sec == min )
_wheel.setPixelColor(sec, _secColor | _minColor);
else if ( sec == hr )
_wheel.setPixelColor(sec, _secColor | _hrColor);
else if ( min == hr )
_wheel.setPixelColor(min, _minColor | _hrColor);
_wheel.checkColorChange();
_wheel.setBrightness(_wheel.brightnessIndexValue);
_wheel.show();
#ifdef DEBUG
DEBUG_PRINTTIME( _currentTime );
DEBUG_PRINTLN("");
#endif
return false;
}
示例10: if
sharedarray<float> monomial_gradient::eval(float x, float y) {
float * grad_val = new float[2]{0.0f, 0.0f};
if (this->x_exp > 0 && this->y_exp > 0)
{ // at least x*y
grad_val[0] = this->x_exp * std::pow(x, this->x_exp - 1) * std::pow(y, this->y_exp); //<=>
grad_val[1] = std::pow(x, this->x_exp) * this->y_exp * std::pow(y, this->y_exp - 1); //<=>
}
else if (this->x_exp == 0 && this->y_exp == 0)
{ //x^0y^0 => nothing to derive here
grad_val[0] = 0.f;
grad_val[1] = 0.f;
}
else if (this->x_exp > 0)
{ //x^n * y^0 => x^n
grad_val[0] = this->x_exp * std::pow(x, this->x_exp - 1); //y^0 => 1
grad_val[1] = 0.f;
}
else if (this->y_exp > 0)
{ //x^0 * y^m => y^m
grad_val[0] = 0.f;
grad_val[1] = this->y_exp * std::pow(y, this->y_exp - 1);
}
else
{
//there is no other case :)
DEBUG_PRINTLN("The impossible has happened in " << __FILE__ << " in " << __LINE__);
}
sharedarray<float> gradient(grad_val);
return gradient;
}
示例11: stringprint_P
uint8_t Adafruit_MQTT::subscribePacket(uint8_t *packet, const char *topic,
uint8_t qos) {
uint8_t *p = packet;
uint16_t len;
p[0] = MQTT_CTRL_SUBSCRIBE << 4 | MQTT_QOS_1 << 1;
// fill in packet[1] last
p+=2;
// put in a message id,
p[0] = 0xAD;
p[1] = 0xAF;
p+=2;
p = stringprint_P(p, topic);
p[0] = qos;
p++;
len = p - packet;
packet[1] = len-2; // don't include the 2 bytes of fixed header data
DEBUG_PRINTLN(F("MQTT subscription packet:"));
DEBUG_PRINTBUFFER(buffer, len);
return len;
}
示例12: DEBUG_PRINTLN
uint8_t Adafruit_MQTT::pingPacket(uint8_t *packet) {
packet[0] = MQTT_CTRL_PINGREQ << 4;
packet[1] = 0;
DEBUG_PRINTLN(F("MQTT ping packet:"));
DEBUG_PRINTBUFFER(buffer, 2);
return 2;
}
示例13: setup
void setup() {
wait_for_serial();
// set the local name peripheral advertises
blePeripheral.setLocalName("Initial");
// set the UUID for the service this peripheral advertises:
blePeripheral.setAdvertisedServiceUuid(whistlepunkService.uuid());
// add service and characteristics
blePeripheral.addAttribute(whistlepunkService);
blePeripheral.addAttribute(valueCharacteristic);
blePeripheral.addAttribute(configCharacteristic);
blePeripheral.addAttribute(versionCharacteristic);
versionCharacteristic.setValue(version);
// assign event handlers for connected, disconnected to peripheral
blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler);
blePeripheral.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);
valueCharacteristic.setEventHandler(BLESubscribed, bleNotificationSubscribeHandler);
valueCharacteristic.setEventHandler(BLEUnsubscribed, bleNotificationUnsubscribeHandler);
configCharacteristic.setEventHandler(BLEWritten, bleConfigChangeHandler);
ble_addr_t _local_bda;
char _device_name[BLE_MAX_DEVICE_NAME+1];
ble_client_get_factory_config(&_local_bda, _device_name);
sprintf(BleLongName, "Sci%02x%02x", _local_bda.addr[0], _local_bda.addr[1]);
DEBUG_PRINT("Address is: ");
DEBUG_PRINTLN(BleLongName);
blePeripheral.setLocalName(BleLongName);
// advertise the service
blePeripheral.begin();
}
示例14: DEBUG_PRINTLN
/**************************************************************************
*
* Update the long name (20 characters or less!)
*
**************************************************************************/
void GoosciBleGatt::setLongName(const char *newName) {
if (strlen(newName) > BTLE_BUFFER_SIZE - 1) {
DEBUG_PRINTLN(F("Name too long; new name was not set. "));
return;
} else {
strcpy(longName, newName);
}
}
示例15: DEBUG_PRINTLN
void Display::showTelemetry(Receiver *receiver) {
if (telemetrySattelites == receiver->lastSeenSatellites()
|| telemetryFix == receiver->haveFix()) {
return;
}
telemetryFix = receiver->haveFix();
telemetrySattelites = receiver->lastSeenSatellites();
if (!receiver->haveFix()) {
DEBUG_PRINTLN("Telemetry waiting for gps fix");
}
DEBUG_PRINT("Telemetry sat:");
DEBUG_PRINTLN(telemetrySattelites);
}