Toshiba Photorelay Review #2 Application of TLP3547 in Project[Copy link]
This post was last edited by Beifang on 2018-10-11 16:33 Application in the project1.The basic component evaluation of TLP3547 only explains the application scheme. It should be more convenient to apply it in practical projects. 2. Here we first use the Blink program,
Use digital output to control the input, so that the LED light can be lit. Arduino program code is as follows;
// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); pinMode(LED_BUILTIN, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0); // print out the value you read: Serial.println (voltage); if (voltage <3) { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); } if (voltage > 3) { digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); } }