Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 841 with an OLED screen #5639

Open
Masterkiller25 opened this issue Apr 29, 2024 · 1 comment
Open

Error 841 with an OLED screen #5639

Masterkiller25 opened this issue Apr 29, 2024 · 1 comment

Comments

@Masterkiller25
Copy link

Masterkiller25 commented Apr 29, 2024

/*It 's in javascript*/
function degtorad (num: number) {
    return num * Math.PI / 180
}
function draw_line (x1: number, y1: number, x2: number, y2: number, color: number) {
    dx = x2 - x1
    dy = y2 - y1
    for(let x = x1;x < x2; x++){
        let y = y1 + dy * (x- x1) / dx
        OLED12864_I2C.pixel(x, y, color)
    }
}
function coo (angle: number, dist: number) {
    radangle = degtorad(angle)
    x2 = Math.cos(radangle) * (dist * (64 / 400))
    y2 = Math.sin(radangle) * (dist * (64 / 400))
    return [x2 + 64, y2 + 62]
}
let arr: number[] = []
let dist = 0
let i = 0
let y2 = 0
let radangle = 0
let dx = 0
let dy = 0
let x2 = 0
basic.showLeds(`
    . . . . .
    . . . . .
    . . # . .
    . . . . .
    . . . . .
    `)
OLED12864_I2C.init(60)
OLED12864_I2C.on()
OLED12864_I2C.clear()
let minborne = 25
let maxborne = 65
basic.forever(function () {
    if (1 == pins.digitalReadPin(DigitalPin.P1)) {
        pins.analogWritePin(AnalogPin.P0, 488)
    }
    if (1 == pins.digitalReadPin(DigitalPin.P2)) {
        pins.analogWritePin(AnalogPin.P0, 0)
    }
    robotbit.GeekServo5KG(robotbit.Servos.S1, i)
    dist = sonar.ping(
    DigitalPin.P15,
    DigitalPin.P14,
    PingUnit.Centimeters
    )
    arr = coo(i, 400)/* it work without this*/
    draw_line(64, 62, arr[0], arr[1], 0)/*this*/
    arr = coo(i, dist)/*this*/
    draw_line(64, 62, arr[0], arr[1], 1)/* and this*/
    if (i == maxborne) {
        i = minborne
    }
    i += 1
})

Expected behaviour
It erases the line with max length, and it draws the line with the distance the sonar calculate

Code with extension on GitHub
https://github.com/Masterkiller25/radar

DETAILS.TXT

# DAPLink Firmware - see https://mbed.com/daplink
Unique ID: 9901000051114e4500657006000000550000000097969901
HIC ID: 97969901
Auto Reset: 1
Automation allowed: 0
Overflow detection: 0
Daplink Mode: Interface
Interface Version: 0253
Bootloader Version: 0243
Git SHA: 64359f5c786363065a41ec15c348e3d53568da03
Local Mods: 0
USB Interfaces: MSD, CDC, HID, WebUSB
Bootloader CRC: 0x32eb3cfd
Interface CRC: 0x53375800
Remount count: 0
URL: https://microbit.org/device/?id=9901&v=0253

Desktop :

  • OS: Windows
  • Browser chrome
  • Version 22H2

Additional context
I use an OLED screen with i²c, and I test it with show numbers and it's work
The error code appearer after 7 sec, and it rests 11 sec then the micro:bit is rebooting

@Masterkiller25 Masterkiller25 changed the title error 841 after a few second Error 841 with an OLED screen Apr 29, 2024
@martinwork
Copy link
Contributor

@Masterkiller25 Please post a hex file, or shared project URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants