# P5js pixels not working

**URL:** <https://discourse.processing.org/t/p5js-pixels-not-working/17561>\
**Category:** Beginners\
**Created:** [February 5, 2020, 2:38am UTC](https://discourse.processing.org/t/p5js-pixels-not-working/17561 "2020-02-05T02:38:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thunderball](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@thunderball](https://discourse.processing.org/u/thunderball)\
**Post date:** [February 5, 2020, 2:38am UTC](https://discourse.processing.org/t/p5js-pixels-not-working/17561/1 "2020-02-05T02:38:44Z")

</div>

hi all, this program does not work, I am copying a tutorial from The Coding Train which seems to work: `https://youtu.be/nMUMZ5YRxHI?t=533`

My test has no pixel being displayed, why?

````auto
<head>
<script src="https://cdn.jsdelivr.net/npm/p5@0.10.2/lib/p5.js"></script>
<style type="text/css">	
  html, body {	
    margin: 0;	
    padding: 0;	
  } 	
  body {
    display:flex;
    justify-content: center;
    align-items: center;
  }
</style>
</head>
<body>
<script type="text/javascript">

  function setup() { 
    createCanvas(360, 360);  
  } 
  function draw() { 
    background(200);
    loadPixels();
      pixels[0] = color(255,0,0);
      pixels[1] = color(255,0,0);
      pixels[2] = color(255,0,0);
      pixels[3] = color(255,0,0);            
    updatePixels();

  }

</script>
</body>
</html>```
````

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [February 5, 2020, 2:44am UTC](https://discourse.processing.org/t/p5js-pixels-not-working/17561/2 "2020-02-05T02:44:03Z")

</div>

[p5js.org/reference/#/p5/pixels](http://p5js.org/reference/#/p5/pixels)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [February 5, 2020, 3:46am UTC](https://discourse.processing.org/t/p5js-pixels-not-working/17561/3 "2020-02-05T03:46:11Z")

</div>

also check out this math  
[https://editor.p5js.org/kll/sketches/G8UOHRv8](https://editor.p5js.org/kll/sketches/G8UOHRv8)
