Skip to content

HighASG936/hw262

Repository files navigation

🇺🇸 English🇪🇸 Español


Language Index


hw262

Library to use HW262 shield using on Arduino

General view

devices

Suitables Temperature Sensors and IR receptor

Packages

packages sensors

Datasheets

How Connect temp sensors

When using the LM35, you must remove jumper J1 from the board and place the sensor on J4 like this:

lm35

To use the DS18 sensor, make sure that jumper J1 is on the board and connected like this:

ds18

How connect IR receptor

Schematic

schm

How to use library

After to download and install the library into your IDE, write respective header on your project. Then create invoke shield object by HW262:

#include <hw262.h>

void setup(){
  HW262.begin();
 HW262.display.clear();
}

void loop(){
  // Write your code here
}

Led

Hw262 includes 4 independent leds named d4, d3, d2, d1. Follow snnipet show how to use it:

HW262.ledOn(D1_PIN);     // Turn on d1
HW262.ledOff(D1_PIN);    // Turn off d1
HW262.ledToggle(D3_PIN); // Toggle state of d3

Buzzer

Buzzer included on this board can be use it like this:

  HW262.buzzerOn();     // Turn on buzzer
  HW262.buzzerOff();    // Turn off buzzer
  HW262.buzzerToggle(); // Turn state of buzzer

Potenciometer

The R10 showed on early schematic is connected to A0, an analog pin from Arduino UNO. To get level voltage on A0 by potenciometer R10, use whatever those methods:

  unsigned char measure = HW262.readPinPot();    // Gate value from A0 (0-254)
  unsigned char voltage = HW262.getVoltagePot(); // Get voltage on pin A0

Switches

Hw262 includes 3 independent switches named s1, s2, s3. But... how to know it was pressed?

  bool switchState = IsPressed(S1_PIN);    // Read state of switch 1

  if(switchState)
  {
    Serial.println("Don't touch this! - MC Hammer");
  }

LM35 Sensor

You can connect an Temperature sensor LM35 by dedicated socket showed on early sensors picture. Be careful with sensor connections in order to avoid damage it.

By default, hw262 library initialize the board with LM35's features. Here is an usage examples:

  unsigned char measure = HW262.tempSensor.readLm35Sensor(); // Read value on A4 (0-254)
  float temp = HW262.tempSensor.measureCentigrads()/100; // Read temperature (°C) with 2 decimals

Whether you omit /100 at last line and - for instance - real temperature is 23°C you will obtain 2300 as output.

DS18 Sensor

After initializing the library, you can automatically utilize the sensor by adding this line to your code:

uint32_t temp = HW262.ds18.getTemp();

Whether you need to customize features of the HW262.ds18 sensor, you can modify the sensor object using the inherited features fromDallasTemperature.h.(link to library docs)

IR Receptor

Bluetooth & Serial port

Here is a simple example to use bluetooth:

#include <hw262.h>

uint32_t wTime = 1500:

void setup() 
{
  HW262.begin();
   HW262.display.clear();
}

void loop()
{  
  String temp = String(HW262.ds18.getTemp())+"°C";
  Serial.println(temp);
  delay(wTime);
}

Notice that you only have to use the Serial library from the default Arduino libraries. The hw262 library sets the serial port using HW262.begin() before it is used. You can connect any sensor with a UART port like this:


hw262

Librería para usar el shield HW262 en la plataforma de Arduino

Vista General

devices

Sensores de temperatura y receptores IR compatibles

Encapsulados

packages sensors

Hojas de datos

Cómo conectar los sensores de temperatura

Cuando uses el sensor LM35, debes remover el jumper en el conector J1 que está en la tarjeta. Después, coloca el sensor en el conector J4 de la siguiente manera: lm35

Para usar el sensor DS18, asegúrate de colocar el jumper en el conector J1 de la tarjeta, y conectar el sensor de la siguiente manera: To use the DS18 sensor, make sure that jumper J1 is on the board and connected like this:

ds18

Cómo conectar un receptor IR

Diagrama esquemático

schm

Cómo usar la librería

After to download and install the library into your IDE, write respective header on your project. Then create invoke shield object by HW262:

#include <hw262.h>

void setup(){
  HW262.begin();
 HW262.display.clear();
}

void loop(){
  // Write your code here
}

Led

Hw262 includes 4 independent leds named d4, d3, d2, d1. Follow snnipet show how to use it:

HW262.ledOn(D1_PIN);     // Turn on d1
HW262.ledOff(D1_PIN);    // Turn off d1
HW262.ledToggle(D3_PIN); // Toggle state of d3

Buzzer

Buzzer included on this board can be use it like this:

  HW262.buzzerOn();     // Turn on buzzer
  HW262.buzzerOff();    // Turn off buzzer
  HW262.buzzerToggle(); // Turn state of buzzer

Potenciometer

The R10 showed on early schematic is connected to A0, an analog pin from Arduino UNO. To get level voltage on A0 by potenciometer R10, use whatever those methods:

  unsigned char measure = HW262.readPinPot();    // Gate value from A0 (0-254)
  unsigned char voltage = HW262.getVoltagePot(); // Get voltage on pin A0

Switches

Hw262 includes 3 independent switches named s1, s2, s3. But... how to know it was pressed?

  bool switchState = IsPressed(S1_PIN);    // Read state of switch 1

  if(switchState)
  {
    Serial.println("Don't touch this! - MC Hammer");
  }

LM35 Sensor

You can connect an Temperature sensor LM35 by dedicated socket showed on early sensors picture. Be careful with sensor connections in order to avoid damage it.

By default, hw262 library initialize the board with LM35's features. Here is an usage examples:

  unsigned char measure = HW262.tempSensor.readLm35Sensor(); // Read value on A4 (0-254)
  float temp = HW262.tempSensor.measureCentigrads()/100; // Read temperature (°C) with 2 decimals

Whether you omit /100 at last line and - for instance - real temperature is 23°C you will obtain 2300 as output.

DS18 Sensor

After initializing the library, you can automatically utilize the sensor by adding this line to your code:

uint32_t temp = HW262.ds18.getTemp();

Whether you need to customize features of the HW262.ds18 sensor, you can modify the sensor object using the inherited features fromDallasTemperature.h.(link to library docs)

IR Receptor

Bluetooth & Serial port

Here is a simple example to use bluetooth:

#include <hw262.h>

uint32_t wTime = 1500:

void setup() 
{
  HW262.begin();
   HW262.display.clear();
}

void loop()
{  
  String temp = String(HW262.ds18.getTemp())+"°C";
  Serial.println(temp);
  delay(wTime);
}

Notice that you only have to use the Serial library from the default Arduino libraries. The hw262 library sets the serial port using HW262.begin() before it is used. You can connect any sensor with a UART port like this:

About

Library to control the HW262 Arduino shield. Supports temperature sensors (LM35, DS18B20), IR receiver, LEDs, buzzer, potentiometer, switches, and serial communication. Provides simple functions to manage each component with the Arduino IDE.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors