Jump to content

AJB2K3

Eurobricks Vassals
  • Posts

    88
  • Joined

  • Last visited

Everything posted by AJB2K3

  1. Please bear with me as I am not braining very well. I've tried to send ser.write(b'\x55\xff\x00\x51\x01') after configuring the port in an attempt to make the RCX bleep but I'm obviously missing something here. I have tried reading through alligators source, the LASM document and @Bliss code but still turning dumb on this. Can I get some help please?
  2. I already have the structure and flow control for the Interface B but the RCX is a different beast.
  3. Just started using the python module and its so easy to use, I just wish I could brain how its working in the background and what bytes its actually sending and receiving.
  4. I used AI to create the ULI blockly front end for my Interface B code but it got to a stage where the AI kept getting confused blocking the port and causing the "Its A Trap" error when running the code which instantly crashes code and programs.
  5. They work that out, they just can’t fathom how stupid we humans can get
  6. When you put faith in AI, always be disappointed. Now I know the core foundations I have to start from scratch because Gemini keeps hitting what I call the Admiral Ackbar crash
  7. I thought I read somewhere that it it still used the handshake. Thanks, for pointing to the document and the clues. Unfortunately spent all last night rebuilding the IDE after a typo in the RCX's sensor read function broke everything (yes user error because of dyslexia)
  8. I had to manually compile and install the NQC tools to get firmware uploaded but once that was done, it all works (well somewhat) and I can now control the Interface B and the RCX from my IDE.
  9. Holy Necropsy Batman! Hay Guys, I have put a pause on the cybermaster C2 at the moment to work on the RCX 1.0. I'm trying to make a firmware uploaded but stuck on the first hurdle. I cant get the IR LED to trigger the IR detection icon on my 3 test RCX's Has anyone got a python script for this?
  10. @maehw you want some free software that controls the Interface B on multiple machine like OSX and RPI? https://github.com/Ajb2k3/ULI
  11. the CM's use the MK2A and 2B 9V motors which are prone to failure and both my modules had a failed motor (thankfully on opposite sides). NO, I think its in command mode 5 flashes instead of 3 after receiving a message but still trying to get the motors running. Triggers acceptance flash but no motors or beeps. import serial import time PORT = '/dev/cu.usbserial-24110' def nqc_force_drive(ser): # The header that is currently giving you 5 flashes header = bytes([0x02, 0x05, 0x00, 0x10, 0xEF, 0x10, 0xEF, 0xFD, 0x03]) sync = bytes([0xA5, 0x5A]) # 1. Set Power B to 7 (22 DD 07 F8) set_pwr = bytes([0x22, 0xDD, 0x07, 0xF8]) # 2. Motor B ON + Forward (21 DE 81 7E) # This is the bitmask that bridges the 7.2V rail to the motor pins. drive_fwd = bytes([0x21, 0xDE, 0x81, 0x7E]) print("--- 5-Flash State Active: Forcing H-Bridge Engagement ---") try: # We flood this to 'latch' the state before the watchdog times out for _ in range(50): ser.write(header + sync + set_pwr + sync + drive_fwd) time.sleep(0.04) except KeyboardInterrupt: pass try: ser = serial.Serial(PORT, 2400, parity=serial.PARITY_ODD, timeout=0.1) nqc_force_drive(ser) ser.close() except Exception as e: print(f"Error: {e}")
  12. Ok we have the Cybermaster brick receiving now continuously but it just flashes 3 times when a command is sent to the motors.
  13. When the green light flashes it means its received the transmission.
  14. Update Managed to get the Cybermaster brick's LED to flash with: import serial import time PORT = '' def sweep_channels(ser): # We use the Opcode 0x10 (Battery Poll) because it's proven to work. # We will try Channel 0 (A6), Channel 1 (A7), and Channel 2 (A8). # Math: Length(05) + Sync + Opcode(10) + Op_Comp(EF) + Opcode(10) + Op_Comp(EF) channels = { "Ch 0 (A6)": 0xA6, "Ch 1 (A7)": 0xA7, "Ch 2 (A8)": 0xA8 } for name, sync in channels.items(): # Calculating checksum: (Length + Sync + 10 + EF + 10 + EF) # Note: 10+EF = FF. So: 05 + Sync + FF + FF checksum = (0x05 + sync + 0xFF + 0xFF) & 0xFF packet = bytes([0x02, 0x05, sync, 0x10, 0xEF, 0x10, 0xEF, checksum, 0x03]) print(f"--- Testing {name} ---") print(f"TX: {packet.hex(' ')}") ser.reset_input_buffer() ser.write(packet) time.sleep(0.5) if ser.in_waiting > 0: res = ser.read(ser.in_waiting).hex(' ') print(f"RX: {res}") else: print("RX: [Accepted]") time.sleep(1.0) # Gap to let the Brick reset try: ser = serial.Serial(PORT, 2400, parity=serial.PARITY_ODD, timeout=2) sweep_channels(ser) ser.close() except Exception as e: print(f"Error: {e}")
  15. Hmm gemini is loosing patience with this now. import serial import time PORT = '/dev/cu.usbserial-24110' # Update this to your port def send_nqc_style(ser, channel, opcode, data=[]): # 1. Prepare Inner RF Data with Complements # Every byte (opcode, data, and inner sum) is followed by its NOT inner_raw = [opcode] + data inner_sum = sum(inner_raw) & 0xFF rf_body = [] for b in inner_raw + [inner_sum]: rf_body.append(b) rf_body.append(b ^ 0xFF) # Complement # 2. Add Channel (usually not complemented) full_payload = [channel] + rf_body # 3. Calculate Outer Tower Checksum # Tower logic: Sum includes the Length byte + the payload length_byte = len(full_payload) outer_sum = (length_byte + sum(full_payload)) & 0xFF # 4. Construct Final Frame packet = [0x02, length_byte] + full_payload + [outer_sum, 0x03] print(f"\nTX: {bytes(packet).hex(' ')}") ser.write(bytes(packet)) time.sleep(0.6) # Required for RF turnaround if ser.in_waiting > 0: res = ser.read(ser.in_waiting) print(f"RX: {res.hex(' ')}") return res print("RX: [No Response - Brick didn't reply]") return None try: ser = serial.Serial(PORT, 2400, parity=serial.PARITY_ODD, timeout=2) # Critical: The CyberMaster often ignores commands unless a # 'Keep Alive' or 'Link' has been established recently. print("--- Polling Battery (The 'NQC' Way) ---") # Expected TX for Opcode 0x10: 02 05 00 10 ef 10 ef fd 03 send_nqc_style(ser, 0, 0x10) time.sleep(1) print("\n--- Sending Beep ---") # 0x51 is beep, 0x02 is the sound type send_nqc_style(ser, 0, 0x51, [0x02]) ser.close() except Exception as e: print(f"Error: {e}") this python code causes the brick to flash in receiving but the function calls don't work.
  16. I changed my adapter, moved back to raw python and sent 0xFE 0x00 0x00 0xFF but got back 0x00 Before on the pl2303 adapter I was just getting b\'' I cant find the opp/bytecodes in NQC, can someone send me the link to them please? I've also loopback tested all my cables and they work, its just sorting out coms.
  17. Yeh, I am aware of that thread and posted a comment. everything I have tried so far has failed so I’m wondering if my adapters can’t do 2400, If the adapters are stuck in 9600 bps. the problem with the CM and Spybotics transmissions could be down to timing and BPS. Oh I just discovered bps is set in the driver, I wonder if that’s my problem that the driver is set to 9600 and overriding the code setting
  18. Hay guys I need some help as im lost getting Cybermaster and Spybotics functions to work can you guys help? I have uploaded a zip file to my GitHub called broken.zip where I'm struggling here. https://github.com/Ajb2k3/ULI
  19. Oh i didnt know that. if thats the case then it should be possible to pull something together using an rp2040 of what ever the current version is My current version Availble as as zip on git hub runs on OSX and RPI with no changes. I built it on python to be truly cross compatible. The only difference for the pi is that there is an installation file that neeeds to be run to setup the VM and install the python dependencies
  20. Damn typo, sorry. Again typos, I have a scout ordered and in the post. I know the CM came before the RCX Because I brought the CM when it fist came out in the UK but had to wait for the RCX 2.0 to come out to get the RCX 1.0 series. Thanks for your replies. I'm working in OSX so it needs an Arduino to act as an adapter but then the Arduino+interface A will be treated as an Interface B. I never considered direct running from the RPI but again I do believe that the I/O pins were measured @12V so an adapter is still needed (don't have one to varyfy.) I got the Interface B running with a simple python program first, then sorted on the other functions then got board and built the IDE.
×
×
  • Create New...