Search found 1706 matches

by mnfisher
Sun Mar 22, 2026 4:32 pm
Forum: General
Topic: Creating a string to be used in a digital output statement
Replies: 4
Views: 201

Re: Creating a string to be used in a digital output statement

Hi, Yes - sorry it won't simulate. Of it was useful it could be converted into a component, with separate implementation to do the simulation. It is also specific to AVR MCUs - although it might be possible to do a similar thing on others (it relies on the port register's having a fixed interval bet...
by mnfisher
Sat Mar 21, 2026 9:06 pm
Forum: General
Topic: Creating a string to be used in a digital output statement
Replies: 4
Views: 201

Re: Creating a string to be used in a digital output statement

I had a little play with this. I used an Arduino Uno - however the code will run as is on an Mega. I created a macro SetPin(port, pin, on) - that takes a port ('B', 'C' etc) - this calculates the address of the port register and writes the required value to set the pin on or off. No check is made th...
by mnfisher
Sat Mar 21, 2026 10:04 am
Forum: General
Topic: ESP32 UART-USB Brige How to use
Replies: 41
Views: 17400

Re: ESP32 UART-USB Brige How to use

Hi Stefan,

Yes - it will open a new COM port (see my example above - I think it changed to COM18).

Can you upload you sample project?

Martin
by mnfisher
Fri Mar 20, 2026 1:54 pm
Forum: General
Topic: ESP32 UART-USB Brige How to use
Replies: 41
Views: 17400

Re: ESP32 UART-USB Brige How to use

Progress 👍

Do you get any output from the usb?

Martin
by mnfisher
Fri Mar 20, 2026 2:19 am
Forum: General
Topic: Creating a string to be used in a digital output statement
Replies: 4
Views: 201

Re: Creating a string to be used in a digital output statement

The easiest way to do this is with a little C.

For example for port d (assuming the pin is set as an output)

PORTD |= (1 << FCL_PIN);

Will turn on 'pin' without affecting other pins in port d

Martin
by mnfisher
Tue Mar 17, 2026 8:08 am
Forum: Projects - Embedded
Topic: AJ-SR04M Returning 9999 while using the AJ-SR04M Component
Replies: 17
Views: 3188

Re: AJ-SR04M Returning 9999 while using the AJ-SR04M Component

Hi Pierre,

Good to hear you have it working. Arrays are very useful - enjoy :-)

I'd be tempted to just use 0 as an invalid reading... then can just do if(.distance) which is slightly more efficient than if (.distance != 9999)


Martin
by mnfisher
Mon Mar 16, 2026 9:19 pm
Forum: Projects - Embedded
Topic: AJ-SR04M Returning 9999 while using the AJ-SR04M Component
Replies: 17
Views: 3188

Re: AJ-SR04M Returning 9999 while using the AJ-SR04M Component

Hi, Sorry to take so long getting back to this - a few days away... So - in the end I just wired a standard resistor (47K) across R19 (for mode 4). Less than elegant. I then wired to a UART (I used a software port on an Arduino for testing) - and fired off the trigger (1) at 20ms intervals. I connec...
by mnfisher
Fri Mar 13, 2026 2:57 am
Forum: Projects - Embedded
Topic: AJ-SR04M Returning 9999 while using the AJ-SR04M Component
Replies: 17
Views: 3188

Re: AJ-SR04M Returning 9999 while using the AJ-SR04M Component

I'm just waiting on some resistors to have a play.... In the UART modes it outputs the length as two bytes - in a 4 byte block (header, datahi, datalo, checksum) - the length is datahi * 256 + datalo So if we catch the data to an array d[4] it would be d[1] x 256 + d[2] The result is in mm The excep...
by mnfisher
Thu Mar 12, 2026 4:41 am
Forum: General
Topic: HexToDecimal
Replies: 4
Views: 636

Re: HexToDecimal

by mnfisher
Sun Mar 08, 2026 6:58 am
Forum: Projects - Embedded
Topic: AJ-SR04M Returning 9999 while using the AJ-SR04M Component
Replies: 17
Views: 3188

Re: AJ-SR04M Returning 9999 while using the AJ-SR04M Component

The component only seems to work with the compatibility mode.
The other modes are interesting too though - I'll try and add something to the board so I can easily switch the connection at r19 and play some more....

Martin