Jump to content

AJB2K3

Eurobricks Vassals
  • Posts

    35
  • Joined

  • Last visited

About AJB2K3

Spam Prevention

  • What is favorite LEGO theme? (we need this info to prevent spam)
    Lego Technic
  • Which LEGO set did you recently purchase or build?
    8462 Technic Tow truck

Profile Information

  • Gender
    Male
  • Interests
    Well, Lego Technic and Robotics

Extra

  • Country
    UK

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 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.
  2. They work that out, they just can’t fathom how stupid we humans can get
  3. 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
  4. 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)
  5. 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.
  6. 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?
  7. @maehw you want some free software that controls the Interface B on multiple machine like OSX and RPI? https://github.com/Ajb2k3/ULI
  8. 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}")
  9. Ok we have the Cybermaster brick receiving now continuously but it just flashes 3 times when a command is sent to the motors.
  10. When the green light flashes it means its received the transmission.
  11. 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}")
  12. 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.
×
×
  • Create New...