woensdag 31 augustus 2016

Arduino_Shield_TFT_LCD_2_Touch

Recently i received via another (different) TFT 2.4 shield:












Tried SDcard read and wri
te program and SDcard seems to work!
The info program i found to read info from this second TFT LCD shields gave this info:
reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 00 Inversion Control
reg(0x00B6) 00 00 00 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 Panel Control
reg(0x00CC) 00 00 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3

reg(0x00EF) 00 00 00 00 00 00 ILI9327

The LCD Demo Statistics program did not work with this TFT shield!

As i did not yet tested the touch possibilities with my first shield, i wanted to test it with both shields.Found a "paint program" TFT Colorbar for the TFT shield.
This program TFT Colorbar program displays colored blocks and a drawing area on the screen. It reacted to touching the screen but not in a correct way. X and Y seemed swapped.
Found on line 35 
landscape=0 and changed this to landscape=1 After this the program worked (on both TCT screens) !

TFT Colorbar

"paint program" (with line 35  Landscape changed from 0 to 1)
On codebender:

Code:// the regular Adafruit "TouchScreen.h" library only works on AVRs

// different mcufriend shields have Touchscreen on different pins
// and rotation.
// Run the UTouch_calibr_kbv sketch for calibration of your shield

//#include <Adafruit_GFX.h>    // Core graphics library
//#include <Adafruit_TFTLCD.h> // Hardware-specific library
//Adafruit_TFTLCD tft(A3, A2, A1, A0, A4);
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;       // hard-wired for UNO shields anyway.
#include <TouchScreen.h>

#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif


// These are the pins for some typical shields!
// S6D0154: YP=A1, XM=A2, YM=7, XP=6
// ST7783 : YP=A2, XM=A1, YM=6, XP=7
// ILI9320: YP=A2, XM=A3, YM=8, XP=9
// ILI9325: YP=A1, XM=A2, YM=7, XP=6
// ILI9325BG: YP=A2, XM=A1, YM=6, XP=7
// ILI9341: YP=A2, XM=A1, YM=7, XP=6
// ILI9488: YP=A1, XM=A2, YM=7, XP=6
// R65109V: YP=A2, XM=A1, YM=6, XP=7

// most mcufriend shields use these pins and Portrait mode:
uint8_t YP = A1;  // must be an analog pin, use "An" notation!
uint8_t XM = A2;  // must be an analog pin, use "An" notation!
uint8_t YM = 7;   // can be a digital pin
uint8_t XP = 6;   // can be a digital pin
uint8_t Landscape = 1;

uint16_t TS_LEFT = 920;
uint16_t TS_RT = 150;
uint16_t TS_TOP = 940;
uint16_t TS_BOT = 120;

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
//  ( was 300 )
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 250);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

int16_t BOXSIZE;
int16_t PENRADIUS = 3;
uint16_t oldcolor, currentcolor;

void setup(void)
{
    Serial.begin(9600);
    Serial.println(F("Paint_kbv !"));

    tft.reset();
    uint16_t identifier = tft.readID();
//    if (identifier == 0) identifier = 0x9341;
/*    if (0) {
    } else if (identifier == 0x0154) {
        Serial.println(F("Found S6D0154 LCD driver"));
        TS_LEFT = 914; TS_RT = 181; TS_TOP = 957; TS_BOT = 208;
    } else if (identifier == 0x7783) {
        Serial.println(F("Found ST7783 LCD driver"));
        TS_LEFT = 865; TS_RT = 155; TS_TOP = 942; TS_BOT = 153;
        Landscape = 1;
    } else if (identifier == 0x9320) {
        Serial.println(F("Found ILI9320 LCD driver"));
        YP = A3; XM = A2; YM = 9; XP = 8;
        TS_LEFT = 902; TS_RT = 137; TS_TOP = 941; TS_BOT = 134;
    } else if (identifier == 0x9325) {
        Serial.println(F("Found ILI9325 LCD driver"));
        TS_LEFT = 900; TS_RT = 103; TS_TOP = 96; TS_BOT = 904;
    } else if (identifier == 0x9341) {
        Serial.println(F("Found ILI9341 LCD driver BLUE"));
        TS_LEFT = 920; TS_RT = 139; TS_TOP = 944; TS_BOT = 150;
        Landscape = 0;
    } else if (identifier == 0) {
        Serial.println(F("Found ILI9341 LCD driver DealExtreme"));
        TS_LEFT = 893; TS_RT = 145; TS_TOP = 930; TS_BOT = 135;
        Landscape = 1;
    } else if (identifier == 0 || identifier == 0x9341) {
        Serial.println(F("Found ILI9341 LCD driver RED"));
        TS_LEFT = 128; TS_RT = 911; TS_TOP = 105; TS_BOT = 908;
        Landscape = 1;
    } else if (identifier == 0x9488) {
        Serial.println(F("Found ILI9488 LCD driver"));
        TS_LEFT = 904; TS_RT = 170; TS_TOP = 950; TS_BOT = 158;
    } else if (identifier == 0xB509) {
        Serial.println(F("Found R61509V LCD driver"));
        TS_LEFT = 889; TS_RT = 149; TS_TOP = 106; TS_BOT = 975;
        Landscape = 1;
    } else {
        Serial.print(F("Unknown LCD driver chip: "));
        Serial.println(identifier, HEX);
        return;
    } */ 
    ts = TouchScreen(XP, YP, XM, YM, 250);     // was 300 call the constructor AGAIN with new values.
    tft.begin(identifier);
    BOXSIZE = tft.width() / 6;
    tft.fillScreen(BLACK);

    tft.fillRect(0, 0, BOXSIZE, BOXSIZE, RED);
    tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, YELLOW);
    tft.fillRect(BOXSIZE * 2, 0, BOXSIZE, BOXSIZE, GREEN);
    tft.fillRect(BOXSIZE * 3, 0, BOXSIZE, BOXSIZE, CYAN);
    tft.fillRect(BOXSIZE * 4, 0, BOXSIZE, BOXSIZE, BLUE);
    tft.fillRect(BOXSIZE * 5, 0, BOXSIZE, BOXSIZE, MAGENTA);

    tft.drawRect(0, 0, BOXSIZE, BOXSIZE, WHITE);
    currentcolor = RED;
    delay(1000);
}

#define MINPRESSURE 10
#define MAXPRESSURE 1000

void loop()
{
    int tmp;
    TSPoint p = ts.getPoint();

    // if sharing pins, you'll need to fix the directions of the touchscreen pins
    pinMode(XM, OUTPUT);
    pinMode(YP, OUTPUT);
    // we have some minimum pressure we consider 'valid'
    // pressure of 0 means no pressing!

    if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
        if (Landscape) {   // swap X and Y
            tmp = p.x;
            p.x = p.y;
            p.y = tmp;
        }
        // scale from 0->1023 to tft.width  i.e. left = 0, rt = width
        // most mcufriend have touch (with icons) that extends below the TFT 
        // screens without icons need to reserve a space for "erase"
        p.x = map(p.x, TS_LEFT, TS_RT, 0, tft.width());
        p.y = map(p.y, TS_TOP, TS_BOT, 0, tft.height());

        if (p.y < BOXSIZE) {
            oldcolor = currentcolor;

            if  (p.x < BOXSIZE)   {                currentcolor = RED;                tft.drawRect(          0, 0, BOXSIZE, BOXSIZE, WHITE);} 
            else if (p.x < BOXSIZE * 2) {                currentcolor = YELLOW;             tft.drawRect(BOXSIZE,     0, BOXSIZE, BOXSIZE, WHITE);} 
            else if (p.x < BOXSIZE * 3) {                currentcolor = GREEN;              tft.drawRect(BOXSIZE * 2, 0, BOXSIZE, BOXSIZE, WHITE);} 
            else if (p.x < BOXSIZE * 4) {                currentcolor = CYAN;               tft.drawRect(BOXSIZE * 3, 0, BOXSIZE, BOXSIZE, WHITE);} 
            else if (p.x < BOXSIZE * 5) {                currentcolor = BLUE;               tft.drawRect(BOXSIZE * 4, 0, BOXSIZE, BOXSIZE, WHITE);} 
            else if (p.x < BOXSIZE * 6) {                currentcolor = MAGENTA;            tft.drawRect(BOXSIZE * 5, 0, BOXSIZE, BOXSIZE, WHITE);}

            if (oldcolor != currentcolor) {
                if (oldcolor == RED) tft.fillRect  (0, 0, BOXSIZE, BOXSIZE, RED);
                if (oldcolor == YELLOW) tft.fillRect(BOXSIZE    , 0, BOXSIZE, BOXSIZE, YELLOW);
                if (oldcolor == GREEN) tft.fillRect(BOXSIZE * 2, 0, BOXSIZE, BOXSIZE, GREEN);
                if (oldcolor == CYAN) tft.fillRect(BOXSIZE * 3, 0, BOXSIZE, BOXSIZE, CYAN);
                if (oldcolor == BLUE) tft.fillRect(BOXSIZE * 4, 0, BOXSIZE, BOXSIZE, BLUE);
                if (oldcolor == MAGENTA)tft.fillRect(BOXSIZE * 5, 0, BOXSIZE, BOXSIZE, MAGENTA);
            }
        }
        if (((p.y - PENRADIUS) > BOXSIZE) && ((p.y + PENRADIUS) < tft.height())) {
            tft.fillCircle(p.x, p.y, PENRADIUS, currentcolor);
        }
        if (p.y > tft.height() - 10) {
            Serial.println("erase");
            // press the bottom of the screen to erase
            tft.fillRect(0, BOXSIZE, tft.width(), tft.height() - BOXSIZE, BLACK);
        }
    }
}

On the shield at the top of the TFT screen is a button that reacts the same as the Arduino reset button. 
Detail of this TFT screen (2)  are the 5 icons on the bottom om the TFT screen :
[Home]  [Book]  [Mail]  [Photo]  [Video]

Link to some interesting info:

dinsdag 30 augustus 2016

Arduino_KY-018_Photo_resistor_module

Arduino KY-018 Photo resistor module

Photo resistor 37in1 sensor KY-018 tested with Arduino

Hardware connections

  • Module Signal (S)  -  Arduino A5  (analog in) 
  • Module +5V (Pin2) -  Arduino 5V 
  • Module GND          - Arduino GND

Program

The program below reads the analog signal and outputs it to the serial monitor..
Open serial monitor to see the values.

Console



Links

https://tkkrlab.nl/wiki/Arduino_KY-018_Photo_resistor_module




maandag 29 augustus 2016

Arduino_Shield_TFT_LCD_MCUFriend2.2

On the arduino forum ( https://forum.arduino.cc/index.php?topic=366304.0 ) is a long discussion about MCDfriends TFT LCD displays
There are different 2.4 TFT LCD MCU friends displays http://domoticx.com/arduino-shield-2-4-tft-lcd-touch/
In this blog you find are pictures of the shield LCD shield i wanted to test.

Warning:

With some of the boards the USB B-type port on the Arduino Uno R3 is taller then the headers. As a result, many shields, including this one can contact the metal shielding of the USB port, causing damage. The simplest way to avoid this is to place a piece of electrical tape, or other tape, on top of the USB port to insulate it. ( Source : http://www.xcluma.com/how-to-use-2.4inch-tft-lcd-mcufriend )


My shield has no connections or parts where the USB port is located therefore i did not insulate it.
My shield has also an SD card reader that i tested earlier .
On codebender.com i found a working Arduino to read info from the TFT LCD shields

I cloned the program , it worked for my shield :
Serial Monitor (to read the info)

This is the result i found on the Serial Monitor when running it with my 2.4 LCD MCUFriend shield

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 02 Inversion Control
reg(0x00B6) 00 0A 82 27 04 Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 21 00 00 00 00 Panel Control
reg(0x00CC) 00 71 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 03 03 NVM Read
reg(0x00D3) 00 00 93 41 ILI9341, ILI9488
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00EF) 00 03 80 02 02 02 ILI9327
reg(0x00F2) 00 02 02 02 02 02 02 02 02 02 02 02 Adjust Control 2
reg(0x00F6) 00 01 00 00 Interface Control

Pin layput

Shield pins with corresponding Arduino pins

LCD_D2   - Arduino Digital 2
LCD_D3   - Arduino Digital 3
LCD_D4   - Arduino Digital 4
LCD_D5   - Arduino Digital 5
LCD_D6   - Arduino Digital 6
LCD_D7   - Arduino Digital 7

LCD_D0    - Arduino Digital 8
LCD_D1    - Arduino Digital 9
SD_SS       - Arduino Digital 10
SD_DI        - Arduino Digital 11
SD_DO      - Arduino Digital 12
SD_SCK    - Arduino Digital 13


LCD_RST   - Arduino Analog 5
LCD_CS     - Arduino Analog 4
LSD_RS      - Arduino Analog 3
LCD_WR    - Arduino Analog 2
LCD_RD     - Arduino Analog 1

GND   - Arduino GND

5V   - Arduino 5V
3V3   - Arduino 3V

LCD demo / statistics

Another Arduino codebender program that worked on my shield is the program below.
The first time you need to be patient before you see something on the display.
The Serial Monitor outputs some statistic.





This is a sample output on the Serial Monitor:

TFT LCD test
Using Adafruit 2.8" TFT Breakout Board Pinout
TFT size is 240x400
Found ILI9341 LCD driver
240X400Benchmark                Time (microseconds)
Screen fill              1652596
Text                     403176
Lines                    5247424
Horiz/Vert Lines         171516
Rectangles (outline)     103188
Rectangles (filled)      3070180
Circles (filled)         1658068
Circles (outline)        2195988
Triangles (outline)      1279256
Triangles (filled)       1575676
Rounded rects (outline)  594328
Rounded rects (filled)   3623000
Done!

Some links






vrijdag 26 augustus 2016

Arduino_KY-009_3-color_full-color_LED_SMD_module_NotWorking

KY-009 37-1 3-color full-color LED SMD module

Some versions do contain additional resistors on the module. However some versions don't. In that case
 additional resistors are needed
On the internet i found examples with

  • 2 x 100 Ohm and one 180 Ohm, 
  • 3x 390 Ohm 
  • 3x 220 Ohm.

The pin layout can also be different.
My module contains the text  cnt1 / Keys / 3_Clor and -GRB is printed as pin layout and contains no additional resistors on the PCB. ( cnt1 in small letters) I also have seen variants with CNT1 in big letters and -RGB
I tried my RGB led module (after adding the additional Resistors) but i did not get my module working !

Hardware

  • Arduino pin 11 --> 100 Ohm resistor --> Pin 'B' of KY-009 module
  • Arduino pin 9   --> 180 Ohm resistor --> Pin 'R' of KY-009 module
  • Arduino pin 10 --> 100 Ohm resistor --> Pin 'G' of KY-009 module
  • Arduino GND  --> pin '-' of KY-009 module

Program

Remark : My LED module did not work!

Function

Using PWM it would be possible to get different colors on the SMD led.

More info


donderdag 25 augustus 2016

Arduino_SD_card_module

Tested SD card reading with Arduino
Used for this test Ethernet shield (with SD card)
The programs are copies of the demo programs from the Arduino.cc website
  • Card Info: Get info about your SD card.
  • Datalogger: Log data from three analog sensors to an SD card.
  • Dump File: Read a file from the SD card.
  • Files: Create and destroy an SD card file. (*)
  • List Files: Print out the files in a directory on a SD card.
  • Read Write: Read and write data to and from an SD card.
The default Arduino library for SD card is huge! With the example read/write sketch, when compiled it’s 13690 Bytes which is half of the available flash space on an Arduino pro mini!
So if you are tight in sketch space, it’s a good idea to find a smaller library.

For the programs below you need the ( codebender ) Serial Monitor as interface.

Card Info

Get info about your SD card.

Datalogger

Log data from three analog sensors to an SD card.

Dump File

Read a file from the SD card.

Files

Create and destroy an SD card file.
This demo program on  https://www.arduino.cc/en/Tutorial/Files did not work.

List Files

Print out the files in a directory on a SD card.

Read Write

Read and write data to and from an SD card.




MCUFRIEND SD card

I also have a "mcufriend" TFT LCD shield with SD card reader and hoped the SD card program would

work also direct out of the box. I tried it and  ... not working.
On this shield near the connector is some text and found the corresponding Arduino pins for the SD
SD_SS      - Arduino  digital 10
SD_DI       - Arduino  digital 11
SD_DO     - Arduino  digital 12
SD_SCK   - Arduino  digital 13

Expect the chip select pin for the SD card in on this LCD shield is 10 ( not 4 as on the Ethernet shield).
Tested this with changing this in one of the scripts above ( ReadWrite ) and it worked !

More info

SD Library
https://www.arduino.cc/en/Reference/SD

Using the SD library to create and remove files on a SD card
>   https://www.arduino.cc/en/Tutorial/Files

Using the SD library to retrieve information over a serial port

Some things to keep in mind when using the SD Library
>  https://www.arduino.cc/en/Reference/SDCardNotes

Library options as the default lib is huge!
http://blog.oscarliang.net/sd-card-arduino/

Adafruit
https://learn.adafruit.com/adafruit-micro-sd-breakout-board-card-tutorial/library




woensdag 24 augustus 2016

Slicing pictures (4) using it for IRremote

The slicing of pictures of a remote control and using it for InfraRed remotes with IRcodes measured with IRsensor on ESP8266 ( or Arduino ).
Currently i store the IR remote codes from each remote control in a spreadsheet with tabs/pages for each remote control.
There are columns in the spreadsheet with
  • The IR code
  • The location A01 B01 etc on the remote control
  • Text on the remote control button (As text, for numbers enter ‘1 to force 1 as text
  • Remote control function without special characters ( FF,  not >> etc.)
From this you can make in other columns the HTML code for a table:
Use something like this as a starting point.  
<table>
<tr><td> A01.jpg </td>
<td>       B01.jpg </td>
<td>       C01.jpg </td>
<td>       D01.jpg </td></tr>
<tr><td> A02.jpg </td>
<td>       B02.jpg </td>
<td>       C02.jpg </td>
<td>       D02.jpg </td></tr>
</table>


Change code to display the picture  <img src="A01.jpg" > with formulas in your spreadsheet.  
Add the IRcontrol code and the function description as output in your table. You can also use the spreadsheet to create ( ESP8266Basic ) programming code like


Let IRcode_Power = “012435”
Let IRcode_Mute = “013335”
Let IRcode_CannelPlus  = “022435”
Let IRcode_CannelPlus  = “025535”
Let IRcode_VolumePlus  = “062235”
Let IRcode_VolumeMinus  = “061135”
Let IRcode_1 = “014435”
Let IRcode_2 = “015535”
Let IRcode_3 = “016635”
Let IRcode_FF  = “051135”
Let IRcode_FB  = “052235”


To avoid programming code like  Let IRcode_>>  = “051135” i included in the spreadsheet not only >> >| but also a column with the function without special characters (  FF Play , Pause,  Stop.)
The data from the spreadsheet can also be pushed an ( MySQL ) database to use it with a home automation system.

dinsdag 23 augustus 2016

Arduino 1602A LCD with I2C

Made LCD 1602A with I2C interface working with Arduino after using the Arduino LCD shield for some tests. The disadvantages of the Arduino LCD shield are that it uses s lot of the Arduino IO pins and fitting it in a nice box can give some problems with nthe IO connections.
The module LCD1602A with an 16x2 display i received from China had a separate I2C interface module, so i soldered them first together.
There are several discussions and misinterpretations about this module. I hope this post will help some people.
It took me time than expected to get the module up and running. The problems where more hardware than software related. The article  http://forum.arduino.cc/index.php?topic=128635.0 on the Arduino forum helped me a lot.
Here is how i finally got my LCD display working:

Connect GND, VCC, SDA and SCL to the corresponding connections GND, VCC, SDA and SCL on the Arduino Uno. I did not connect them to the analog input lines as suggested.

Use an I2C scan program to find the address of the LCD and write it down as you will need this in the next program. This I2C scan program worked for me and gave (on the console) the address

Program to scan I2C

Console / serial monitor

Test the LCD with a program where, if needed, the I2C address is modified to the address found with the I2C scan program. This part was the most difficult. Sometimes adding libraries was needed, and even after this some additional libraries where also needed. Step one in the article on the Arduino forum also suggested downloading and renaming a library.
Sometimes i observed reactions of the LCD (blinking/ flashing). Getting characters on the LCD screen did not work. I tested several programs.
The real problem was the contrast of the pixels on the LCD. You can change the pixel contrast by inserting a screwdriver into the pot meter ( potentiometer ) at the back and turning it.
For me the setting of the pot meter was the most critical step. Characters are visible only in a very small range.
The pot meter is for the pixel contrast. The pot meter is NOT for the back-light !
I already had played with this pot meter using some of the LCD programs but without success. The program where i had luck was written for a 4 x 20 display. I only had modified the I2C address in the program and suddenly during slow turning the pot meter i had my output.
After this i modified the program for a 2 x 16 character output:

Program to test LCD (2*16)


Remark:

It should be possible to change the I2C address using the A0 A1 A2 pins on the I2C interface. This way you can connect multiple displays.
I did not test this (yet).

maandag 22 augustus 2016

ESP8266_KY015


I already had tested an DHT11 module with the ESP8266. Now i also tested the DHT11 temperature / humidity sensor on the 37in1 module KY015 with ESP8266Basic

Hardware connections

-         GND
middle VCC 3V3
S        Signal line - ESP8266 Pin 5

Program

' TestKY015.bas
PinDHT11 = 5

DHT.SETUP( 11 , PinDHT11 )
cls

print "<br>Pin : " & PinDHT11 & "<br>Time : " & time() & "<br>Temperature : " & DHT.TEMP() & "<br>Humidity :" & DHT.HUM()

end

vrijdag 19 augustus 2016

Slicing pictures (3) photo chop

In the article this week i describe how to do the slicing with Adobe Photoshop 6 using tips from the previous Adobe articles about Shift Control J , Saved Selections and the naming conventions.
No i did not sliced all the pictures of remote controls this way. The first pictures i even sliced on a less efficient way!
  • Load the Photoshop file with the picture ( see article 1 )
  • In the Photoshop file are already saved selections for the columns ( article 2)
  • Make for each Row (starting with the top row a separate layer using Shift Control J. Rename the layer to Dnn where nn is the Row number. At this moment the layer contains the picture data for the columns A B C and D for this row.
  • During this process hide the layers with the sliced parts.
  • When ready with creating all rows you can start slicing this rows:
  • Select and make visible the first row  ( D01 )
  • Use load selection A to load column A. Use Shift CTRL J Rename the new Layer to A01  
  • Use load selection B to load column C. Use Shift CTRL J Rename the new Layer to B01  
  • Use load selection C to load column C. Use Shift CTRL J Rename the new Layer to C01
  • The “original” first row already had the name D01 (This layer has column A, B and C now slices off from D)  
Do this on a similar way with all the rows.
If you need combinations of columns load the saved selection of the combination ( E.g. AB or BC ) Rename the layer using the naming convention earlier explained, ( E..g A01B  or B07C )
If you have all the slices ready save the Photoshop *.psd file for backup.

The next step is saving each separate layer as separate picture file ( .jpg or .png ) with filename the layer name. Some versions of Adobe Photoshop and some other drawing programs have macro’s or special functions to do this in one step. Before separating and saving first re-size the complete picture to nice size to display it on the web.

donderdag 18 augustus 2016

ESP8266_KY-006_Small_passive_buzzer_module

This is the test of the KY-006 passive buzzer in the 37in1 "Arduino" sensor kit
 with ESP8266Basic.
On my blog you can also find a test of KY-006 with Arduino.
Hardware

Pin S ESP8266 Pin 5
Pin (middle) not connected
Pin - GND ESP8266 Ground


' Test KY006
cls
PinBuz = 5
pwBuz = 0
pwBuzMax = 500

html | <h1>Test KY006 Buzzer</h1> |
html | <table> |
html | <tr><td> |
button "0", [SetPinBuz0]
html | </td><td> |
slider pwBuz , 0 , pwBuzMax
html | </td><td> |
button "Max", [SetPinBuzMax] 

html | </td></tr><tr><td> |
button "SetSliders" , [SetSliders]
html | </td><td><center> |
button "SlidersMid" , [SetPinBuzMid]
html | </center></td><td> |
button " Exit ", [Exit]
html | </td></tr></table> |

wait

[SetPinBuz0]
pwBuz = 0
Goto [SetSliders]

[SetPinBuzMid]
pwBuz = pwBuzMax / 2
Goto [SetSliders]

[SetPinBuzMax]
pwBuz = pwBuzMax
Goto [SetSliders]

[SetSliders]
io(pwo,PinBuz,pwBuz)
wait

[Exit]
end