sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
OWP_DG_LCD_Sensors.ino File Reference

Example-Code for a generic Display Device (e.g. Sensor, Display) More...

#include <avr/wdt.h>
#include <EEPROM.h>
#include <Wire.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"
#include <PJON.h>

Macros

#define ENABLE_UNITTEST
 
#define SENSOR   "owp:lcd:v1"
 
#define READ_INFO   0x01
 
#define READ_VCC   0x11
 
#define READ_TEMP   0x12
 
#define READ   0x21
 
#define WRITE   0x22
 
#define WRITE_CAL   0x32
 
#define pin_onewire   12
 

Functions

unsigned long RAM_lRebootCount __attribute__ ((section(".noinit")))
 
PJON< SoftwareBitBang > bus (44)
 
void setup ()
 
void receiver_function (uint8_t *payload, uint16_t length, const PJON_Packet_Info &packet_info)
 
void loop ()
 
float readVcc ()
 
float readTemp (void)
 

Variables

uint8_t mem_read [22]
 
uint8_t mem_buffer [256]
 
uint8_t mem_buffer_ [256]
 
unsigned long EEPROM_lPowerCount
 
unsigned long EEPROM_lPowerCount_
 
unsigned long time_last_update
 
SSD1306AsciiWire oled
 

Detailed Description

Example-Code for a generic Display Device (e.g. Sensor, Display)

Author
drtrigon
Date
2018-07-06
Version
1.0
* OneWire PJON Generic "OWPG" scheme:
*   Server e.g. linux machine or raspi
*      OWPJON/LINUX/Local/LocalUDP/RemoteWorker/DeviceGeneric/
*      OWPJON/LINUX/Local/ThroughSerial/RemoteWorker/DeviceGeneric/
*   Tunnel(er) similar to 1wire master (similar cause we are on a multi-master bus) e.g. AVR
*      OWPJON/ARDUINO/Local/SoftwareBitBang/Tunneler/BlinkingSwitch/
*      OWPJON/ARDUINO/Local/SoftwareBitBang/Tunneler/BlinkingSwitch_SWBB-TS/
*      OWPJON/ARDUINO/Local/ThroughSerial/SoftwareBitBangSurrogate/Surrogate/ (obsolete)
*   Devices e.g. AVR
*      OWPJON/ARDUINO/Local/SoftwareBitBang/DeviceGeneric/
*      OWPJON/ARDUINO/Local/SoftwareBitBang/OWP_DG_LCD_Sensors/ (this sketch)
*      ...
*
* Compatible with: atmega328 (Uno, Nano), atmega32u4 (Yun)
*
* Pinout:
*   1wire PJON data bus (OWPJON SWBB):
*        1WIRE DATA    -> Arduino Pin D12
*        GND black     -> Arduino GND
*
* Test on Ubuntu or Raspberry Pi Server (owpshell) confer the docu of
* following files:
*   - @ref OWPJON/LINUX/Local/LocalUDP/RemoteWorker/DeviceGeneric/DeviceGeneric.cpp
*   - @ref OWPJON/LINUX/Local/ThroughSerial/RemoteWorker/DeviceGeneric/DeviceGeneric.cpp
*
* Thanks to:
* gioblu - PJON 11.0 and support
*          @see https://www.pjon.org/
*          @see https://github.com/gioblu/PJON
* fredilarsen - support
* 

Macro Definition Documentation

#define ENABLE_UNITTEST
#define pin_onewire   12
#define READ   0x21
#define READ_INFO   0x01
#define READ_TEMP   0x12
#define READ_VCC   0x11
#define SENSOR   "owp:lcd:v1"
#define WRITE   0x22
#define WRITE_CAL   0x32

Function Documentation

unsigned long RAM_lRebootCount __attribute__ ( (section(".noinit"))  )
PJON<SoftwareBitBang> bus ( 44  )
void loop ( void  )

OneWirePJON device status update function.

Returns
(void)
float readTemp ( void  )

Internal Temperature Sensor for ATmega328 types.

Parameters
void
See Also
receiver_function()
https://playground.arduino.cc/Main/InternalTemperatureSensor
Returns
The chip temperature in [°C]
float readVcc ( )

Accessing the secret voltmeter on the Arduino 168 or 328.

See Also
receiver_function()
http://code.google.com/p/tinkerit/wiki/SecretVoltmeter
Returns
The supply voltage in [V]
void receiver_function ( uint8_t *  payload,
uint16_t  length,
const PJON_Packet_Info &  packet_info 
)
void setup ( void  )

Arduino IDE: put your setup code here, to run once.

Variable Documentation

unsigned long EEPROM_lPowerCount
unsigned long EEPROM_lPowerCount_
uint8_t mem_buffer[256]
uint8_t mem_buffer_[256]
uint8_t mem_read[22]
SSD1306AsciiWire oled
unsigned long time_last_update