Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function circleBres (xc: number, yc: number, r: number) {
- y = r
- d = 3 - 2 * r
- drawCircle(xc, yc, x, y)
- while (y >= x) {
- x += 1
- if (d > 0) {
- y += -1
- d = d + 4 * (x - y) + 10
- } else {
- d = d + 4 * x + 6
- }
- drawCircle(xc, yc, x, y)
- basic.pause(100)
- }
- }
- input.onButtonPressed(Button.B, function () {
- circleBres(64, 32, 16)
- })
- function drawCircle (xc: number, yc: number, x: number, y: number) {
- OLED12864_I2C.pixel(xc + x, yc + y, 1)
- OLED12864_I2C.pixel(xc - x, yc + y, 1)
- OLED12864_I2C.pixel(xc + x, yc - y, 1)
- OLED12864_I2C.pixel(xc - x, yc - y, 1)
- OLED12864_I2C.pixel(xc + y, yc + x, 1)
- OLED12864_I2C.pixel(xc - y, yc + x, 1)
- OLED12864_I2C.pixel(xc + y, yc - x, 1)
- OLED12864_I2C.pixel(xc - y, yc - x, 1)
- }
- let x = 0
- let d = 0
- let y = 0
- OLED12864_I2C.init(60)
- OLED12864_I2C.zoom(false)
Advertisement
Add Comment
Please, Sign In to add comment