n0xa / m5stick-nemo

M5 Stick C firmware for high-tech pranks
Other
764 stars 157 forks source link

Make it so you can change the ir led pin in settings #44

Closed SuperSeno closed 1 month ago

SuperSeno commented 9 months ago

Could you please make it so you can change the IR pin ether 9 or 26 in settings?

FNTTRTXM5 commented 8 months ago

On G26 an 5out i hope n0xa will make an option for it

n0xa commented 8 months ago

I haven't forgotten about this. It might be a good project for someone who wants to take a crack at contributing. A few things I've been thinking about:

LED pin should be able to be set to Pin 26, 32, or 33 on StickC, Plus and Plus2. 32/33 are on the GROVE port next to the USB port. On Cardputer, Pin 1 or 2 are exposed on the GROVE port.

The settings must also allow for active-high (digitalWrite HIGH turns on the LED) or active-low (digitalWrite LOW turns on the LED). The StickC Plus and Plus2 use Active-low with the internal LED for example, and some external IR LEDs are also active-low, particularly high-power ones that use the 5VDC pin.

I hope to get around to this eventually if someone else doesn't. implementing it by itself isn't hard, but implmenting it cleanly might be a little challenging.

FNTTRTXM5 commented 8 months ago

Here is an example for M5StickCPlus: /// TV-B-GONE /// void tvbgone_setup() { // Disable the internal LED display (M5StickC Plus does not have a direct DISP connection) M5.dis.clear();

// Add the code for external IR LED initialization here pinMode(5, OUTPUT); // Set Pin 5 (5OUT) as output pinMode(26, OUTPUT); // Set Pin 26 as output

// ...

// Now you can use the IR LED on Pin 5 and G26 digitalWrite(5, HIGH); // Turn on the IR LED on Pin 5 digitalWrite(26, HIGH); // Turn on the IR LED on G26

delay_ten_us(5000);

if (region == NA) { M5.dis.println(TXT_RG_AMERICAS); } else { M5.dis.println(TXT_RG_EMEA); }

M5.dis.println(TXT_SEL_GO_PAUSE); M5.dis.println(TXT_SEL_EXIT); delay(1000); }