vsdip / vsdsquadron_pio

Apache License 2.0
4 stars 2 forks source link

issue in adding header file #16

Closed Skandan-M-M closed 3 months ago

Skandan-M-M commented 3 months ago

image

I am trying to add IRremote.h file which aurdino supports, I am not getting to know how to use this with minisquadron. I tried downloading few similar libraries from registry, but even that didnt work.

image

yathAg commented 3 months ago

Download the file and include it in your project's src folder. However, these libraries will not work natively with the VSDsquadron mini. They are designed for atmega MCUs

You will most likely write the functions you need on your own. your build upon someone else's project that can be found on the VSD website

Skandan-M-M commented 3 months ago

Ok, will try it

Skandan-M-M commented 3 months ago

I am not able to write a library on my own. searched for many references, all other libraries are interlinked and leading to aurdino.h at the end and it is also showing up many errors in header files , I am not able to figure it out. Please help me

the code I am trying is,

include

include

include // Include IRremote library

// Define sensor pin const int RECV_PIN = 4;

// Define IR Receiver and Results Objects IRrecv irrecv(RECV_PIN); decode_results results;

// Define LED pin

define LED_PIN GPIOD

define LED_PIN_NUMBER GPIO_Pin_13

// Enabling clock for the GPIO port

define LED_CLOCK_ENABLE RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE)

void setup() { // Initialize Serial communication for debugging Serial.begin(9600);

// Enable the IR Receiver
irrecv.enableIRIn();

// Initialize LED pin
LED_CLOCK_ENABLE;
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = LED_PIN_NUMBER;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(LED_PIN, &GPIO_InitStructure);

}

void loop() { // Check if IR value is received if (irrecv.decode(&results)) { // Print received IR value Serial.print("IR Value: "); Serial.println(results.value, HEX);

    // If the received IR value matches the specified value
    if (results.value == 0x76A77416) {
        // Turn on the LED
        GPIO_SetBits(LED_PIN, LED_PIN_NUMBER);
        Serial.println("LED turned on.");
    }

    // Resume receiving IR signals
    irrecv.resume();
}

}

please help me out.

yathAg commented 3 months ago

Tagging @VishnuPrakashBharadwaj

Hi Vishnu,

Since you have worked with IR could you provide some pointers as to how @Skandan-M-M can approach the creation of this library

yathAg commented 3 months ago

@Skandan-M-M I would suggest understanding how the Arduino library works and coding it yourself. That's the best way. There should be tutorials on how it works exactly.

Thats the approach Vishnu took

VishnuPrakashBharadwaj commented 3 months ago

As @yathAg mentioned, you can go through the source code of IR_Remote.h / IR_Remote.c and implement similar functions. You can start with collecting raw data from the IR sensor. Here is an example of reading IR data without IR_Remote.h library in Arduino : https://github.com/mbabeysekera/advanced-arduino-ir-remote/blob/main/IR_RemoteDecoder.ino You can go through this and implement the same for VSDSquadron-Mini board.

Skandan-M-M commented 3 months ago

Will try doing this , thank you